Nginx日志记录客户端真实ip
在proxy上设置:(安装时需要添加--with-http_realip_module)
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
set_real_ip_from ip;(这个ip填写的是proxy的ip)
real_ip_header X-Forwarded-For;
在web后端设置:(安装时需要添加--with-http_realip_module)
set_real_ip_from ip;(这个ip填写的是proxy的ip)
real_ip_header X-Forwarded-For;
在log_format里添加$remote_addr或者$http_x_forwarded_for参数。
推荐阅读:
使用Nginx如何配置Tomcat访问日志记录真实IP http://www.linuxidc.com/Linux/2012-03/56119.htm
搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程 http://www.linuxidc.com/Linux/2013-09/89692.htm
LNMP 全功能编译安装 for CentOS 6.3笔记 http://www.linuxidc.com/Linux/2013-05/83788.htm
CentOS 6.3 安装LNMP (PHP 5.4,MyySQL5.6) http://www.linuxidc.com/Linux/2013-04/82069.htm
在部署LNMP的时候遇到Nginx启动失败的2个问题 http://www.linuxidc.com/Linux/2013-03/81120.htm
Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里
