18
18
if ($host ~ ^www\.(?<domain>.+)$ ) {
19
19
return 301 $scheme ://$domain$request_uri ;
20
20
}
21
-
21
+ server_tokens off ;
22
22
server_name _;
23
23
24
24
root /usr/share/nginx/html;
@@ -47,33 +47,22 @@ http {
47
47
try_files $uri $uri .html $uri /index.html /$uri /$uri /index.html =404 ;
48
48
}
49
49
50
- # Media: images, icons, video, audio, HTC
51
- location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webp|webm|htc|woff2|woff)$ {
52
- expires 1y;
53
- access_log off ;
54
- }
55
-
56
- # CSS and Javascript
57
- location ~* \.(?:css|js)$ {
58
- expires 1y;
59
- access_log off ;
60
- }
61
50
62
51
# Plausible script
63
- location /js/script.js {
52
+ location = /js/script.js {
64
53
# Change this if you use a different variant of the script
65
54
proxy_pass https://plausible.io/js/script.js;
66
55
proxy_set_header Host plausible.io;
67
56
68
57
# Tiny, negligible performance improvement. Very optional.
69
58
proxy_buffering on ;
70
59
71
- # make cache WAY lighter
72
- expires 1d ;
60
+ # make cache WAY lighter
61
+ expires 1d ;
73
62
}
74
63
75
64
# Plausible script
76
- location /api/event {
65
+ location = /api/event {
77
66
proxy_pass https://plausible.io/api/event;
78
67
proxy_set_header Host plausible.io;
79
68
proxy_buffering on ;
@@ -83,5 +72,17 @@ http {
83
72
proxy_set_header X-Forwarded-Proto $scheme ;
84
73
proxy_set_header X-Forwarded-Host $host ;
85
74
}
75
+
76
+ # Media: images, icons, video, audio, HTC
77
+ location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webp|webm|htc|woff2|woff)$ {
78
+ expires 1y;
79
+ access_log off ;
80
+ }
81
+
82
+ # CSS and Javascript
83
+ location ~* \.(?:css|js)$ {
84
+ expires 1y;
85
+ access_log off ;
86
+ }
86
87
}
87
88
}
0 commit comments