2025-12-26 21:02:15 +08:00
|
|
|
events {
|
|
|
|
|
worker_connections 1024;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
|
default_type application/octet-stream;
|
2025-12-30 14:13:00 +08:00
|
|
|
upstream user-api {
|
2025-12-30 14:05:26 +08:00
|
|
|
server localhost:33333;
|
2025-12-30 11:19:28 +08:00
|
|
|
}
|
2025-12-30 14:13:00 +08:00
|
|
|
upstream file {
|
2025-12-30 14:05:26 +08:00
|
|
|
server localhost:33333;
|
2025-12-30 11:19:28 +08:00
|
|
|
}
|
2025-12-30 14:13:00 +08:00
|
|
|
upstream story {
|
2025-12-30 14:05:26 +08:00
|
|
|
server localhost:33333;
|
2025-12-30 11:19:28 +08:00
|
|
|
}
|
2025-12-26 21:02:15 +08:00
|
|
|
server {
|
2025-12-31 09:32:01 +08:00
|
|
|
listen 3001;
|
2025-12-26 21:02:15 +08:00
|
|
|
server_name localhost;
|
2025-12-30 11:19:28 +08:00
|
|
|
location /user-api/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
2025-12-30 14:19:22 +08:00
|
|
|
proxy_set_header Authorization $http_authorization;
|
2025-12-30 11:19:28 +08:00
|
|
|
proxy_pass http://user-api/;
|
|
|
|
|
}
|
|
|
|
|
location /file/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
2025-12-30 14:19:22 +08:00
|
|
|
proxy_set_header Authorization $http_authorization;
|
2025-12-30 11:19:28 +08:00
|
|
|
proxy_pass http://file/;
|
|
|
|
|
}
|
|
|
|
|
location /story/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
2025-12-30 14:19:22 +08:00
|
|
|
proxy_set_header Authorization $http_authorization;
|
2025-12-30 11:19:28 +08:00
|
|
|
proxy_pass http://story/;
|
|
|
|
|
}
|
2025-12-26 21:02:15 +08:00
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html index.htm;
|
|
|
|
|
try_files $uri $uri/ /index.html; # 用于处理 SPA 路由
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
|
location = /50x.html {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|