首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

多级 Nginx 传送客户端 IP

2012-11-15 
多级 Nginx 传递客户端 IPlocation / {? proxy_pass ? ? ? ?http://localhost:8000? # Forward the user

多级 Nginx 传递客户端 IP
location / {
? proxy_pass ? ? ? ?http://localhost:8000;

? # Forward the user's IP address to Rails
? proxy_set_header ? ? ? ? ? X-Real-IP $remote_addr;
# needed for HTTPS
# ?proxy_set_header ? ? ? ? ? X_FORWARDED_PROTO https;
? proxy_set_header ? ? ? ? ? X-Forwarded-For $remote_addr;
? proxy_set_header ? ? ? ? ? X-Forwarded-For $proxy_add_x_forwarded_for;
? proxy_set_header ? ? ? ? ? Host $host;
? proxy_redirect ? ? ? ? ? ? ? ?off;
# NginxHttpRealIpModule
? set_real_ip_from ? 192.168.1.0/24;
? set_real_ip_from ? 192.168.2.1;
? real_ip_header ? ? X-Real-IP;
}

最后记得 reload Nginx config

热点排行