Reverse proxy practices can be more than a step for the safety of the site, like some banks must be using the agent is you go into the proxy server can not get any data, the following I introduce nginx with mod_proxy implementation of reverse proxy configuration method.
Because the project needs to implement the function of a domain name agent
Like what:
Copy Code code as follows:
A.com/a.html=>b.com/b.html
That is, using the a.com agent of the use of B.Com Web site request, after a friend introduction with Apache reverse agent can achieve its purpose, the man tried, really cool. It is also extremely convenient to configure.
(Note the following only the reverse proxy, forward to the agent and so I used to introduce hehe)
1. Launch the Apache Mod_proxy module.
Copy Code code as follows:
LoadModule Proxy_module modules/mod_proxy.so
LoadModule Proxy_http_module modules/mod_proxy_http.so
Pay attention to mod_proxy_http.so. I did not add this module to test the agent failed, then the problem disappeared after adding this module
2. Implement the proxy statement
Copy Code code as follows:
proxypass/mirror/foo/http://backend.example.com/
Implement to distribute all requests below the current host/mirror/foo/directory to backend.example.com.
According to my request:
Add a section to the A.com folder directory
Copy Code code as follows:
Everything OK
3. After the domain name agent should note:
3.1: URLs in the Web site are best used relative paths. If you use an absolute path to bypass the proxy, then the host behind the proxy server is exposed easily.
3.2: Note that when referencing the $__server[' server_name '] global variable, the domain name of the current server_name is taken. If you want to take the proxy's domain name, pass $__server[' http_x_forwarded_for ' Get the proxy domain name. Note: Generally used to write cookies and such operations