For Nginx module Introduction can consult the Wiki:http://wiki.nginx.org/modules
Common modules: HTTP Core
Proxy
Rewrite
Upstream
principle:
Squid,varnish and Nginx, when doing reverse proxy, because to replace the client to access the server, so, when the request packet through the reverse proxy, the proxy server here this IP packet IP header has been modified, Finally, the backend Web server gets the header source IP address of the packet is the IP address of the proxy server, so that the back-end server program to give the IP statistics function does not make any sense, so in the agent or cluster must solve this problem, here, When I do a cluster or proxy with nginx how to leave the backend Web server (to be exact, delivery) the real IP address of the client.
First, the following configuration is required on the front-end Nginx:
Location/{
Proxy_pass http://192.168.100.100;
Proxy_set_hearder host $host;
Proxy_set_header x-real_ip $remoute _addr;
};
The configuration file on the Apache server on the backend 192.168.100.100 is modified as follows.
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined
Switch
Logformat "%{x-real-ip}i%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined
Can.
This article is from the "Autumn Fairy tale" blog, please be sure to keep this source http://wushank.blog.51cto.com/3489095/1678370
Nginx forwarding and backend server to obtain real client IP