fix: harden backend production deployment

This commit is contained in:
ANG-Server
2026-07-20 21:07:27 +08:00
parent c995891c1f
commit a72920d1e0
6 changed files with 57 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
server {
listen 80;
server_name whaletownadmin.xinghangee.icu;
root /var/www/whale-town-end-v2/client/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location = /index.html {
add_header Cache-Control "no-cache";
}
location ~* \.(?:js|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable";
try_files $uri =404;
}
}

View File

@@ -0,0 +1,28 @@
server {
listen 80;
server_name whaletownend.xinghangee.icu;
client_max_body_size 24m;
location /game {
proxy_pass http://127.0.0.1:3001/game;
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 3600s;
proxy_send_timeout 3600s;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
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;
}
}