ngnix反向代理后获取用户真实ip

最后都变了- 提交于 2019-12-01 07:14:48

server
{
listen 80;
listen 802;
server_name test111.xxxx.com 118.24.122.131;
#charset koi8-r;
location / {
proxy_pass http://127.0.0.1:82;
# $host 变量,Host 为变量名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#access_log logs/host.access.log main;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root html;
index index.html index.htm default.aspx;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!