Nginx反向代理的核心配置项详解
# 1.Nginx 反向代理
server { | |
listen 80; | |
server_name domain.com; | |
# 前端静态资源 | |
location / { | |
root /usr/share/nginx/html; | |
index index.html; | |
try_files $uri $uri/ /index.html; | |
} | |
# 代理上传文件请求 | |
location ~* ^/upload { | |
proxy_pass http://localhost:5005; | |
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; | |
} | |
} |










