# ============================================================================= # WOOO TECH - Momo Pro System # Nginx Site Configuration # ============================================================================= upstream momo_app { server momo-app:5000; keepalive 32; } server { listen 80; server_name localhost; # 日誌 access_log /var/log/nginx/momo-access.log main; error_log /var/log/nginx/momo-error.log; # 靜態檔案 location /static/ { alias /app/static/; expires 7d; add_header Cache-Control "public, immutable"; } location /web/static/ { alias /app/web/static/; expires 7d; add_header Cache-Control "public, immutable"; } # 反向代理到 Flask 應用 location / { proxy_pass http://momo_app; proxy_http_version 1.1; # Proxy headers 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 Connection ""; # Timeout 設定(配合長時間查詢) proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; # Buffer 設定 proxy_buffering on; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; } # 健康檢查端點 location /health { access_log off; proxy_pass http://momo_app; proxy_connect_timeout 5s; proxy_read_timeout 5s; } # 錯誤頁面 error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }