The code was written after work. The code is divided into forwarding server and proxy server. Let’s talk about the forwarding server first. Although the forwarding server can also be said to be a redirection serverLinux uses a proxy server. For example, the forwarding server eavesdrops on port 80. If A browser user accesses the server IP (the browser requests port 80 by default). After the forwarding server receives the browser user's request, it redirects the browser user's request to other ports on the machine or to other machines on the same public network. Let’s talk about the designated port of the proxy server. First, let me explain that my proxy server can only proxy designated websites or other customers who can proxy, such as the SVN service built on the external network or the intranet that cannot be accessed in some places. website. The proxy server is divided into server and client. The server needs to run on the client and the intranet that everyone can access. The client needs to be placed on the network that can access the customers who need the proxy, or it can be placed on the customer's local machine. superior. Usage: Unzip proxy.tar.gz and enter the proxy directory. Then makelinux uses the proxy server, which will generate three programs we need, transmit (forwarding server), manager (proxy server), client (proxy client) Server-side usage: ./transmit [port] (for example, 80)./manager [port] (specify arbitrarily) Client-side usage: ./client-i[proxy server IP]:[port]-t[customer IP]:[ Port] -d [customer domain name] For example: If my intranet server IP is 1.2.3.4, and the proxy customer is NetEase (NetEase domain name:, IP: 202.108.9.33), the server side runs as follows./transmit80./mananger8000 client side Run ./client-i1.2.3.4:8000-t202.108.9.33-d or ./client-i1.2.3.4:8000-t202.108.9.33:80-d as follows and then change the local hosts file ( windows is c:windowssystem32driversetchostslinux is/etc/hosts) fill in the following line 1.2.3.4 Then type in the browser to access NetEase through the proxy server. In fact, if the customer applies for the domain name by himself, he can directly point his domain name to 1.2.3.4, without changing the local hosts file
The above is the detailed content of Detailed introduction and usage of code implementation of forwarding server and proxy server. For more information, please follow other related articles on the PHP Chinese website!