Environment Introduction
Nginx Reverse Proxy: 192.168.127.129
web:192.168.127.134
Operation Process:
Edit nginx.conf Add at the end
Include vhosts/*.conf;
Then create a proxy.conf configuration file in the/usr/local/nginx/conf/vhost/directory
server {Listen 80; server_name 192.168.127.129; Location/{Proxy_pass http://192.168.127.134; Proxy_set_header Host $host;}}
Restart Nginx Service, Access 129 in the browser to see if it will access to the website above 134
The second type of notation
Proxy two different IPs at the same time
Upstream Hu {server 192.168.127.134:80; server 192.168.127.130:80;} server {Listen 80; server_name 192.168.127.129; Location/{Proxy_pass http://hu/; Proxy_set_header Host $host;}}
This will work if one of the servers is broken
This article is from the "Drifting Away" blog, make sure to keep this source http://825536458.blog.51cto.com/4417836/1784868
Nginx Reverse Proxy