nex_buddy/docker/nginx.conf

47 lines
1.3 KiB
Nginx Configuration File
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# 媒体上传上限:后端单文件最大 32MB
client_max_body_size 40m;
# Docker 内置 DNS:api 容器重建后也能重新解析
resolver 127.0.0.11 valid=10s ipv6=off;
set $api_upstream http://api:8000;
proxy_connect_timeout 5s;
location /api/ {
proxy_pass $api_upstream$request_uri;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
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;
}
location /device/ {
proxy_pass $api_upstream$request_uri;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
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;
}
location = /healthz {
proxy_pass $api_upstream$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
# SPA 路由:刷新 /admin、/qr 等路径时回落到 index.html
location / {
try_files $uri $uri/ /index.html;
}
}