The premise is that nginx has been installed, I am compiling and installing, in the /usr/local directory
environment:
Proxy server: eth0:192.168.10.18 eth1:192.168.20.5
web server: 192.168.10.11
Client: 192.168.20.6
1. Configure reverse proxy
cd /usr/local/nginx
vim conf/nginx.conf
Find the minimum face, add this line, and put the configuration in the conf.d directory
cd conf mkdir conf.d
vim wxx.conf
upstream wxx.com { server 192.168.10.11; } server { listen 8080; server_name www.wxx.com; location / { proxy_pass http://wxx.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
Modifying the configuration file requires restarting nginx and accessing www.wxx.com:8080 proxy to the 192.168.10.11 web server
indicate success
2. Configure forward proxy
cd /usr/local/nginx/conf/conf.d
vim forward_proxy.conf
server { ##Agent log configuration off means to turn off log output ##access_log /home/bingchenglin/logs/nginx/access.log; ##The file path can be used to monitor the access of the agent access_log off; ##Configure the service port listen 8090; location / { ##DNS address Multiple DNS addresses are separated by spaces solve 114,114 . 114,114 ; resolver_timeout 30s; ##Environment variable wildcard generally does not change proxy_pass $scheme://$http_host$request_uri; proxy_buffers 256 4k; proxy_max_temp_file_size 0k; } }
Restart nginx and configure it on the client 192.168.20.6
Settings as shown
Originally, the client could not directly access the web server, but now it can access
Since the proxy server can delete the external network, the client cannot access the external network. Now let's continue the test.
Indicates that the two configurations have been successful now. Please use two configuration files to configure the two agents.