来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
222 lines
9.7 KiB
Plaintext
222 lines
9.7 KiB
Plaintext
# 双角色 H5(直连 443 + 可能被 CLB 回源 :80):
|
|
# :80 禁止无条件 301→https,否则 CLB HTTPS 终止后会 ERR_TOO_MANY_REDIRECTS。
|
|
server {
|
|
listen 80;
|
|
server_name www.xdjchuanhui.com xdjchuanhui.com web-admin.xdjchuanhui.com;
|
|
|
|
root /opt/canteen-frontend;
|
|
index index.html;
|
|
|
|
client_max_body_size 25m;
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_comp_level 5;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
|
|
# 安全头(:80 为 CLB 回源,不加 HSTS,避免直连 HTTP 被浏览器强制升级)
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
add_header Pragma "no-cache" always;
|
|
add_header Expires "0" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
try_files /index.html =404;
|
|
}
|
|
|
|
location = /bootstrap.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
try_files /bootstrap.js =404;
|
|
}
|
|
|
|
location = /config.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
try_files /config.js =404;
|
|
}
|
|
|
|
location ~* ^/[a-z0-9_-]+\.(bundle\.)?[a-f0-9]+\.(js|css)$ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location = /bundle.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
try_files /bundle.js =404;
|
|
}
|
|
|
|
location / {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
add_header Pragma "no-cache" always;
|
|
add_header Expires "0" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location /api/workflow/notifications/stream {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
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_set_header Connection '';
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
chunked_transfer_encoding off;
|
|
proxy_read_timeout 1h;
|
|
proxy_send_timeout 1h;
|
|
}
|
|
|
|
location /api/ {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
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;
|
|
}
|
|
|
|
location /deploy {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location /verify/ {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name www.xdjchuanhui.com xdjchuanhui.com web-admin.xdjchuanhui.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/web-admin.xdjchuanhui.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/web-admin.xdjchuanhui.com/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
|
|
|
|
root /opt/canteen-frontend;
|
|
index index.html;
|
|
|
|
client_max_body_size 25m;
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_comp_level 5;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self' https: wss:; media-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-src 'self' https://apis.map.qq.com https://map.qq.com https://mapapi.qq.com; frame-ancestors 'self'" always;
|
|
add_header Permissions-Policy 'geolocation=(self "https://apis.map.qq.com" "https://map.qq.com" "https://mapapi.qq.com"), microphone=(self), camera=(self)' always;
|
|
|
|
# 入口 HTML 禁止缓存,确保普通刷新能拿到最新资源引用
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
add_header Pragma "no-cache" always;
|
|
add_header Expires "0" always;
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self' https: wss:; media-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-src 'self' https://apis.map.qq.com https://map.qq.com https://mapapi.qq.com; frame-ancestors 'self'" always;
|
|
add_header Permissions-Policy 'geolocation=(self "https://apis.map.qq.com" "https://map.qq.com" "https://mapapi.qq.com"), microphone=(self), camera=(self)' always;
|
|
try_files /index.html =404;
|
|
}
|
|
|
|
location = /bootstrap.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
try_files /bootstrap.js =404;
|
|
}
|
|
|
|
location = /config.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
try_files /config.js =404;
|
|
}
|
|
|
|
# 带 hash 的主包、vendor、懒加载分包可长期缓存
|
|
location ~* ^/[a-z0-9_-]+\.(bundle\.)?[a-f0-9]+\.(js|css)$ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# 兼容旧版 bundle.js,不缓存
|
|
location = /bundle.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
try_files /bundle.js =404;
|
|
}
|
|
|
|
location / {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
add_header Pragma "no-cache" always;
|
|
add_header Expires "0" always;
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self' https: wss:; media-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-src 'self' https://apis.map.qq.com https://map.qq.com https://mapapi.qq.com; frame-ancestors 'self'" always;
|
|
add_header Permissions-Policy 'geolocation=(self "https://apis.map.qq.com" "https://map.qq.com" "https://mapapi.qq.com"), microphone=(self), camera=(self)' always;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location /api/workflow/notifications/stream {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
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_set_header Connection '';
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
chunked_transfer_encoding off;
|
|
proxy_read_timeout 1h;
|
|
proxy_send_timeout 1h;
|
|
}
|
|
|
|
location /api/ {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
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;
|
|
}
|
|
|
|
location /deploy {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location /verify/ {
|
|
proxy_pass http://__API_INTERNAL_HOST__:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Authorization $http_authorization;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
}
|