Files
project57-x/nginx.conf
T
mdszxy 1ffb91509c
CI Pipeline / check-commit (push) Successful in 5s
CI Pipeline / deploy-only (push) Has been skipped
CI Pipeline / build (push) Successful in 20s
CI Pipeline / deploy (push) Successful in 17s
feat: proxy admin and Next assets via cluster service [deploy]
2026-10-06 00:22:55 +08:00

88 lines
2.6 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 3000;
server_name _;
root /usr/share/nginx/html;
index index.html;
# 入口脚本写入集群 DNS;变量 proxy_pass 必须配合 resolver
resolver __RESOLVER__ valid=10s ipv6=off;
# B 站自身探针,不转发
location = /api/health {
default_type text/plain;
add_header Content-Type text/plain;
return 200 "ok";
}
# Admin + Next 静态资源 + 其余 API(含 /api/admin、/api/contact、Server Actions)
location /admin {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream$request_uri;
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;
proxy_redirect __A_PUBLIC__/ /;
}
location /_next/ {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream$request_uri;
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location /api/ {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream$request_uri;
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;
}
# 前台 embed 资源
location /embed/ {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream$request_uri;
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location /images/ {
set $a_upstream __A_UPSTREAM__;
proxy_pass $a_upstream$request_uri;
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
try_files $uri $uri/ /index.html;
}
}