Files
claw/nginx/gallery.fukun.net/gallery.fukun.net.nginx.conf
T
fukunee 30918f4642 Add Nginx deny config and server hardening scripts
Add new nginx/deny.conf to block unmatched hosts and explicitly close
fukun.net. Remove Photoview icon hijacking, add client_max_body_size.

Add scripts for deep inspection, disk monitoring, firewall setup,
Gitea port confinement, and security updates.
2026-05-28 10:51:36 +08:00

63 lines
2.4 KiB
Plaintext

server {
listen 80;
server_name gallery.fukun.net cdn.fukun.net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name gallery.fukun.net cdn.fukun.net;
ssl_certificate /etc/nginx/ssl/gallery.fukun.net_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/gallery.fukun.net.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 4G;
# favicon 统一走 fukun.net
location = /favicon.ico { root /home/hugo/hugo-blog/public; }
location = /favicon.png { root /home/hugo/hugo-blog/public; }
location = /favicon.svg { root /home/hugo/hugo-blog/public; }
location = /images/favicon.svg { root /home/hugo/hugo-blog/public; }
location = /favicon-16x16.png { root /home/hugo/hugo-blog/public; }
location = /favicon-32x32.png { root /home/hugo/hugo-blog/public; }
location = /apple-touch-icon.png { root /home/hugo/hugo-blog/public; }
location = /site.webmanifest { root /home/hugo/hugo-blog/public; }
# 劫持 Photoview 图标
location = /photoview-logo.svg { root /home/hugo/hugo-blog/public; try_files /favicon.svg =404; }
location = /logo192.png { root /home/hugo/hugo-blog/public; try_files /favicon-32x32.png =404; }
location = /logo512.png { root /home/hugo/hugo-blog/public; try_files /favicon-32x32.png =404; }
location = /manifest.json { root /home/hugo/hugo-blog/public; try_files /site.webmanifest =404; }
# 静态资源缓存(Photoview 直出,不经代理)
location /assets/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
expires 30d;
add_header Cache-Control "public, immutable";
}
# 相片直出(CDN 回源)
location /photos/ {
alias /home/gallery/photos/;
add_header Access-Control-Allow-Origin "*" always;
}
# Photoview
location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
}