Nginx is not only a high-performance Web server, but also a high-performance reverse proxy server. The following is a brief talk about Nginx reverse proxy function.
What is a reverse proxy?
A reverse proxy is a proxy server that accepts connection requests on the Internet and then forwards the request to a server on the internal or other network and returns the results from the server to the client requesting a connection on the Internet.
Simple Implementation Method:
For example, I want to build a google.ha97.com domain name on the server to reverse proxy access to Google, first in the Domain name Registrar domain name management for the domain name google.ha97.com add a record to the server IP, and then modify the Nginx configuration file on the server, add the following:
Server
{
Listen 80;
server_name google.ha97.com;
Location/{
Proxy_pass http://www.google.com/;
Proxy_redirect off;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}
}
Reload Nginx after saving:
/etc/init.d/nginx Reload
If it is compiled and installed, apply this command:
Kill-hup ' Cat/usr/local/nginx/logs/nginx.pid '
After the domain name resolution is effective, you can visit Google via google.ha97.com. This method can be disguised as Fanqiang. This is the simplest application of nginx reverse proxy. On the use of Nginx reverse proxy load Balancing method, the next time to write again.
(summary) The simplest Nginx reverse proxy configuration on a Linux server