Nginx反向代理

2021-10-27 09:11:54
nginx.conf ``` http { client_max_body_size 10m; # 默认1m太小了,会导致上传文件失败 gzip on; # 后端上游服务列表 upstream backend { server 172.19.13.56:8080 weight=1 max_fails=0; server 172.19.13.57:8080 weight=1 max_fails=0; } server { listen 80; server_name _; location / { # 将请求转到到 backend 中配置的上游后端服务中 proxy_pass http://backend; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $host; } } } ```