83 lines
2.6 KiB
Plaintext
83 lines
2.6 KiB
Plaintext
# 巡樓 Console nginx — dev(Vite + Go gateway + MinIO 公開讀圖)
|
||
#
|
||
# 路由:
|
||
# / → Vite 127.0.0.1:5173
|
||
# /api/ → gateway 127.0.0.1:8888
|
||
# /haixun-assets/ → MinIO 127.0.0.1:9000(path-style bucket)
|
||
#
|
||
# 安裝:
|
||
# sudo cp old/infra/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;
|
||
|
||
# MinIO 公開資源(必須在 location / 之前;否則會落到 Vite SPA)
|
||
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;
|
||
# 瀏覽器快取頭像
|
||
proxy_hide_header x-amz-id-2;
|
||
proxy_hide_header x-amz-request-id;
|
||
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;
|
||
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;
|
||
}
|
||
}
|