Add favicon assets and gallery.fukun.net nginx config

This commit is contained in:
2026-05-25 00:45:33 +08:00
parent 00bb034eca
commit 1ff36a1922
3 changed files with 91 additions and 0 deletions
@@ -0,0 +1,55 @@
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;
# 劫持 Photoview 图标,统一用 fukun.net 的 favicon
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; }
# 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; }
client_max_body_size 4G;
# CORS — 允许 gallery.fukun.net 跨域请求(CDN 回源需要)
add_header Access-Control-Allow-Origin "https://gallery.fukun.net" always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "*" always;
add_header Access-Control-Allow-Credentials "true" always;
location /photos/ {
alias /home/gallery/photos/;
add_header Access-Control-Allow-Origin "*" always;
}
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;
}
}