Index

joshstock.in / 76ff7a3

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
16321 Jan 2023 10:1029e63ddPoint 404 error pages to correct file locationJosh Stockin122G

Blob @ joshstock.in / nginx / prod / servers / analytics.conf

text/plain2405 bytesdownload raw
1server {
2 listen 443 ssl http2;
3 listen [::]:443 ssl http2;
4 server_name analytics.joshstock.in;
5
6 add_header Referrer-Policy origin always; # make sure outgoing links don't show the URL to the Matomo instance
7 add_header X-Content-Type-Options "nosniff" always;
8 add_header X-XSS-Protection "1; mode=block" always; root /var/www/matomo;
9
10 index index.php index.html index.htm;
11 error_page 404 /error/404.html; location = /error/404.html {
12 root /var/www/josh/static;
13 }
14 location / {
15 try_files $uri $uri/ /index.php?$query_string;
16 }
17 location ~ ^/(index|matomo|piwik|js/index|plugins/HeatmapSessionRecording/configs)\.php$ {
18 fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
19 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
20 fastcgi_param HTTP_PROXY "";
21 fastcgi_split_path_info ^(.+\.php)(/.+)$;
22
23 try_files $fastcgi_script_name =404;
24
25 set $path_info $fastcgi_path_info;
26 fastcgi_param PATH_INFO $path_info;
27
28 fastcgi_index index.php;
29 include fastcgi_params;
30 }
31 ## deny access to all other .php files
32 location ~* ^.+\.php$ {
33 deny all;
34 return 403;
35 }
36
37 ## disable all access to the following directories
38 location ~ ^/(config|tmp|core|lang|.git) {
39 deny all;
40 return 403; # replace with 404 to not show these directories exist
41 }
42
43 location ~ /\.ht {
44 deny all;
45 return 403;
46 }
47
48 location ~ js/container_.*_preview\.js$ {
49 expires off;
50 add_header Cache-Control 'private, no-cache, no-store';
51 }
52
53 location ~ \.(gif|ico|jpg|png|svg|js|css|htm|html|mp3|mp4|wav|ogg|avi|ttf|eot|woff|woff2|json)$ {
54 allow all;
55 ## Cache images,CSS,JS and webfonts for an hour
56 ## Increasing the duration may improve the load-time, but may cause old files to show after an Matomo upgrade
57 expires 1h;
58 add_header Pragma public;
59 add_header Cache-Control "public";
60 }
61
62 location ~ ^/(libs|vendor|plugins|misc|node_modules) {
63 deny all;
64 return 403;
65 }
66
67 ## properly display textfiles in root directory
68 location ~/(.*\.md|LEGALNOTICE|LICENSE) {
69 default_type text/plain;
70 }
71 location = /favicon.ico {
72 root /var/www/josh;
73 }
74 location = /static/favicon.png {
75 root /var/www/josh;
76 }
77}
78