79 lines
2.4 KiB
Plaintext
79 lines
2.4 KiB
Plaintext
# Harbor Desk nginx — dev
|
|
# / → Vite :5173
|
|
# /api/ → gateway :8888
|
|
# /haixun-assets/ → MinIO :9000
|
|
#
|
|
# 安裝:
|
|
# sudo cp deploy/nginx/haixun-dev.conf /etc/nginx/conf.d/haixun.conf
|
|
# sudo nginx -t && sudo systemctl reload nginx
|
|
|
|
upstream haixun_backend {
|
|
server 127.0.0.1:8888;
|
|
keepalive 32;
|
|
}
|
|
|
|
upstream haixun_frontend {
|
|
server 127.0.0.1:5173;
|
|
}
|
|
|
|
upstream haixun_minio {
|
|
server 127.0.0.1:9000;
|
|
keepalive 16;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name threads-tool-dev.30cm.net threads-tool.30cm.net;
|
|
|
|
location /haixun-assets/ {
|
|
proxy_pass http://haixun_minio;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $http_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_buffering off;
|
|
expires 7d;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://haixun_frontend;
|
|
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;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_cache_bypass $http_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
|
|
location /api/ {
|
|
proxy_pass http://haixun_backend;
|
|
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;
|
|
# Browser -> nginx is same-origin; gateway should not apply direct-API CORS.
|
|
proxy_set_header Origin "";
|
|
proxy_set_header Authorization $http_authorization;
|
|
proxy_set_header X-Member-Authorization $http_x_member_authorization;
|
|
proxy_set_header Connection "";
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
chunked_transfer_encoding off;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
|
|
location = /health {
|
|
proxy_pass http://haixun_backend/api/v1/health;
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|