Apache server uses mod_rpaf to obtain front-end NginxIP

Since the emergence of Nginx, we all like to let Nginx run ahead to process static files, and then filter dynamic requests to apache. So there is a problem, the IP obtained by the application running on the rear apache is the IP of the server where Nginx is located, or the local machine 127.0.0.1 . The most obvious is to look at the apache access log. You will see that coming and going are all intranet IPs. If your application has security rules for IP discrimination such as “single IP cannot log in repeatedly”, “single IP registrations are separated by n minutes”… and so on. So troublesome… But fortunately, you can modify the parameters of nginx proxy to make the backend application obtain the request message sent by Nginx to obtain the IP of the external network. proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; But the problem solved by this is only on the application, the ip obtained on the apache log is still local. In particular, ill-conceived applications such as Tattertools (a blogging program) make mistakes. The access log in the background shows that the number of visitors is 1, and the ip is from 127.0.0.1…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索