dingdanquanliucheng/deploy/nginx-ddy.conf

70 lines
1.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 业务员端 - ddy.gaowenbu.cnHTTP 版,申请 SSL 后再改 HTTPS
server {
listen 80;
server_name ddy.gaowenbu.cn;
# ---------- 日志 ----------
access_log /www/wwwlogs/ddy.gaowenbu.cn.log;
error_log /www/wwwlogs/ddy.gaowenbu.cn.error.log;
# ---------- 前端静态文件(业务员端) ----------
root /www/wwwroot/ddy.gaowenbu.cn;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}
# ---------- 后端 API 反向代理 ----------
location /api/ {
proxy_pass http://127.0.0.1:8000;
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;
client_max_body_size 20m;
}
# ---------- WebSocket 反向代理 ----------
location /ws/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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_read_timeout 86400s;
proxy_send_timeout 86400s;
}
location = /health {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
}
location /uploads/ {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
}
# Let's Encrypt 文件验证
location ~ /\.well-known {
allow all;
}
# 禁止访问其他隐藏文件
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}