Reverse proxy
The explanation on Baidu Encyclopedia is as follows:
Reverse Proxy method refers to using a proxy server to accept connection requests on the Internet, and then forwards the request to the server on the internal network, and The results obtained from the server are returned to the client requesting a connection on the Internet. At this time, the proxy server appears as a reverse proxy server to the outside world.
Refer to the figure below to understand this process more clearly:
In layman’s terms, a reverse proxy is a server responsible for forwarding requests and request results. From the perspective of the client, it is the server. But in fact it is just the entrance and exit of the service. What actually processes the request and returns the result is the server to which it distributes the request.
For example: We let Nginx listen on port 80, but the port actually used by Tomcat for business processing is 8080. Then when the client sends a request to Nginx, Nginx forwards the request to Tomcat. Tomcat processes the response business logic and returns the processing results to Nginx, and Nginx returns it to the client.
Function
Protect website security and establish a barrier between the Internet and the server. Sensitive information is encrypted to prevent URL rewriting from being exposed, and it acts as a real server stand-in to prevent attacks, etc.
Provides caching function to reduce the pressure on real servers and cache static files, such as CSS, JS, html, images and other static resource files.
Achieve load balancing, distribute requests evenly, and balance the pressure on each server;
The above introduces getting started with nginx (1) - reverse proxy, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.