What is a reverse proxy?
A reverse proxy refers to a proxy server that accepts a connection request on the Internet, then forwards the request to a server on an internal (or other) network, and returns the result obtained from the server to the client requesting a connection on the Internet.
How to do it:
For example, I want to build a www.server110.com is used as a reverse proxy to access twitter. First, the domain name management at the domain name registrar is the domain name www .server110.com add A record to the IP of the VPS , and then modify the Nginx configuration file on the VPS, adding the following:
server
{
listen 80;
server_name www.server110.com;
Location / {
http://twitter.com/;
Proxy_redirect off;
$remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
After adding, execute first:
/usr/local/nginx/sbin/nginx -t
Check whether the configuration is normal, if it shows:
the
configuration file /usr/local/nginx/conf/nginx.conf syntax is
ok
configuration file
/usr/local/nginx/conf/nginx.conf test is successful
It is normal, otherwise modify the configuration according to the error prompt.
Then execute kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
Make the configuration take effect, after the domain name resolution takes effect, you can pass www.server110.com visited twitter.