nginx proxy pass

1. nginx proxy_pass 配置

1
2
3
location / {
proxy_pass http://localhost:8081
}

2. 修改 proxy_pass 返回给用户的url 域名

添加下边3行 proxy_set_header

1
2
3
4
5
6
location / {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}