Index

joshstock.in / 23d65ba

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
14313 Jul 2022 22:48694417dUpdate duplicate declaration in nginx confJosh Stockin105G

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

text/plain2166 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 ## disable all access to the following directories
34 location ~ ^/(config|tmp|core|lang) {
35 deny all;
36 return 403; # replace with 404 to not show these directories exist
37 }
38
39 location ~ /\.ht {
40 deny all;
41 return 403;
42 }
43
44 location ~ js/container_.*_preview\.js$ {
45 expires off;
46 add_header Cache-Control 'private, no-cache, no-store';
47 }
48
49 location ~ \.(gif|ico|jpg|png|svg|js|css|htm|html|mp3|mp4|wav|ogg|avi|ttf|eot|woff|woff2|json)$ {
50 allow all;
51 ## Cache images,CSS,JS and webfonts for an hour
52 ## Increasing the duration may improve the load-time, but may cause old files to show after an Matomo upgrade
53 expires 1h;
54 add_header Pragma public;
55 add_header Cache-Control "public";
56 }
57
58 location ~ ^/(libs|vendor|plugins|misc|node_modules) {
59 deny all;
60 return 403;
61 }
62
63 ## properly display textfiles in root directory
64 location ~/(.*\.md|LEGALNOTICE|LICENSE) {
65 default_type text/plain;
66 }
67 location = /favicon.ico {
68 root /var/www/html;
69 }
70 location = /static/favicon.png {
71 root /var/www/html;
72 }
73}
74