Index

joshstock.in / c5b1652

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
14213 Jul 2022 22:48c5b1652Update nginx analytics confJosh Stockin1780G

Blob @ joshstock.in / nginx / prod / sites-enabled / analytics.conf

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