Generally, when we use the WordPress program, we can see the user's message information in the comment background, including the user's IP address. Of course, it also includes the logs we are using to view user log information. However, if we enable the CDN content distribution function, the IP address information obtained is the CDN IP address, and the real user information cannot be obtained, is there any way to achieve it?
A netizen mentioned this problem yesterday. He uses the Pagoda Panel Nginx WEB environment. After searching here, Lao Zuo found that there was a solution for this netizen, and finally it was solved. Here, Lao Zuo records the solution today so that users in need can use it.
This student uses the pagoda panel. We need to add code to the NGINX configuration file. Modify the configuration file to the HTTP location.
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
Add code.
Finally, restart the NGINX server and see if the log file is the correct user's real IP address. We just need to extract the latest IP search to see if it is our local address, because we are also accessing.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge