Home > Article > Backend Development > The difference between nginx reverse proxy and forward proxy
I have never understood how to understand the reverse direction of the reflection agent. After learning about it through Baidu, and combining it with the picture below, I finally figured it out a little bit. Simply put, the forward direction is from a LAN to the server, and the reverse direction is from the client to a LAN.
Concept:
The reverse proxy method refers to using a proxy server to accept connection requests on the Internet, then forwarding the requests to the server on the internal network, and returning the results obtained from the server to the client requesting a connection on the Internet. At this time, the proxy server appears as a server to the outside world.
Overview:
A common proxy server is only used to proxy internal network connection requests to the Internet. The client must specify a proxy server and send the http request that is to be sent directly to the Web server to the proxy server. Since hosts on the external network will not configure and use this proxy server, ordinary proxy servers are also designed to search for multiple uncertain servers on the Internet, rather than accessing a fixed server in response to requests from multiple clients on the Internet. server, so ordinary web proxy servers do not support external access requests to the internal network. When a proxy server can proxy a host on the external network to access the internal network, this proxy service is called a reverse proxy service. At this time, the proxy server appears as a Web server to the outside world, and the external network can simply treat it as a standard Web server without specific configuration. The difference is that this server does not store the real data of any web pages. All static web pages or CGI programs are stored on the internal Web server. Therefore, attacks on the reverse proxy server will not destroy web page information, thus enhancing the security of the web server.
There is no conflict between the reverse proxy method and the packet filtering method or the ordinary proxy method, so both methods can be used in the firewall device at the same time. The reverse proxy is used when the external network accesses the internal network, and the forward proxy or packet filtering method is used. Used to deny other external access methods and provide internal network access to external networks. These methods can therefore be combined to provide the best secure access.
Why is it called reverse:
But this does not explain why it is called reverse. In principle, the proxy server processes the request from the client and forwards it to the destination server, so the work of the proxy server does not have any reverse meaning. The picture below illustrates why reverse proxy is called reverse:
<code> 对了,从结构上来看,正向代理和反向代理的左右两边换了一下,原本代理服务器的客户端来自内网.其和代理服务器组成一个LAN,而反向代理之后.代理服务器和服务器组成了一组.所以从结构来看,是reverse的,从英文的角度来看,reverse这个词包含翻转的意思,其意思就是指结构图上的这种反转,但是由于翻译的关系.到了中文变成反向代理.其实proxy并没有做和以前有什么不同的事情.它仍旧是将来自客户端的请求转发给实际端.,而时至今日,由于CDN的大量使用,反向代理后面的服务器为了适应这种跨网络的架构,而均采用实际IP地址.这样就往往更不容易使得大家对”反向代理这个名词中的反向到底指什么”这个问题有个清晰的答案了。 </code>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
The above introduces the difference between nginx reverse proxy and forward proxy, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.