-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnginx.conf
More file actions
61 lines (52 loc) · 2.04 KB
/
nginx.conf
File metadata and controls
61 lines (52 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json image/svg+xml;
# Custom 404 error page
error_page 404 /404.html;
location = /404.html {
internal;
}
# Don't allow the site to be embedded in an iframe
add_header X-Frame-Options "SAMEORIGIN" always;
# Cache HTML at edge (purge via Cloudflare API on deploy)
etag on;
add_header Cache-Control "public, max-age=0, s-maxage=31536000, must-revalidate";
# Static assets: cache for 1 year (they're hashed or rarely change)
location /static/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN" always;
}
# Redirects
rewrite ^/apps/$ /work/ permanent;
rewrite ^/projects/$ /open-source/ permanent;
rewrite "^/articles/([0-9]{4})/[0-9]{2}/[0-9]{2}/(.+)$" /articles/$1/$2 permanent;
rewrite ^/articles/2025/announding-rssfilter-com/$ /articles/2025/announcing-rssfilter-com/ permanent;
rewrite ^/articles/2025/coolify-django-db-migrations/$ /articles/2025/safe-django-db-migrations/ permanent;
location /script.js {
proxy_pass https://umami.loopwerk.io/script.js;
proxy_set_header Host umami.loopwerk.io;
proxy_ssl_server_name on;
proxy_buffering on;
}
location /api/send {
proxy_pass https://umami.loopwerk.io/api/send;
proxy_set_header Host umami.loopwerk.io;
proxy_ssl_server_name on;
proxy_buffering on;
proxy_set_header X-Client-Real-IP $http_cf_connecting_ip;
proxy_set_header X-Forwarded-For $http_cf_connecting_ip;
proxy_set_header X-Real-IP $http_cf_connecting_ip;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
location / {
try_files $uri $uri/ =404;
}
}