Files
project57-x/nginx.conf
T
mdszxy 5dc62bd7c4
CI Pipeline / check-commit (push) Successful in 5s
CI Pipeline / deploy-only (push) Has been skipped
CI Pipeline / build (push) Successful in 21s
CI Pipeline / deploy (push) Successful in 17s
fix: start nginx without resolving A-site at boot [deploy]
2026-10-05 20:16:16 +08:00

47 lines
1.2 KiB
Nginx Configuration File

server {
listen 3000;
server_name _;
root /usr/share/nginx/html;
index index.html;
# 由入口脚本写入:集群 DNS + A 站地址。用变量做 proxy_pass,启动时不解析上游,A 站暂不可达也不会让 nginx 起不来。
resolver __RESOLVER__ valid=10s ipv6=off;
location = /api/health {
default_type text/plain;
add_header Content-Type text/plain;
return 200 "ok";
}
location /embed/ {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /images/ {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location = /api/contact {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
try_files $uri $uri/ /index.html;
}
}