nex_buddy/scripts/nginx-nex-buddy.conf

45 lines
1.3 KiB
Plaintext
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.

# Nginx 同域部署模板:Web 静态文件 + /api 与 /device 反代到 FastAPI。
# 把 server_name、root 改成实际值;HTTPS 证书按需用 certbot 配置。
server {
listen 80;
server_name example.com;
root /opt/nex_buddy/web/dist;
index index.html;
# 媒体上传上限:后端单文件最大 32MB
client_max_body_size 40m;
location /api/ {
proxy_pass http://127.0.0.1:8000;
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 http://127.0.0.1:8000;
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 http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
# SPA 路由:刷新 /admin、/qr 等路径时回落到 index.html
location / {
try_files $uri $uri/ /index.html;
}
}