ngnix反向代理后获取用户真实ip
Posted dfsxh
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ngnix反向代理后获取用户真实ip相关的知识,希望对你有一定的参考价值。
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;
}
}
以上是关于ngnix反向代理后获取用户真实ip的主要内容,如果未能解决你的问题,请参考以下文章