Nginx : Reverse Proxy Settings#32015/08/26 |
Configure Nginx for Reverse Proxy Settings with load barancing function.
(1) www.srv.world [10.0.0.31] - Nginx Server
(2) node01.srv.world [10.0.0.51] - Backend Web Server#1 (3) node02.srv.world [10.0.0.52] - Backend Web Server#2 (4) node03.srv.world [10.0.0.53] - Backend Web Server#3 |
|
[1] | For example, Configure Nginx as a proxy server with load barancing for backend httpd Servers. |
[root@www ~]#
vi /etc/nginx/nginx.conf # add into http section # "backup" means this server is baranced only when other servers are down # "weight=*" means barancing weight http { upstream backends { server node01.srv.world:80 weight=3; server node02.srv.world:80; server node03.srv.world:80 backup; } # change like follows in "server" section server { listen 80 default_server; listen [::]:80 default_server; server_name www.srv.world; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; location / { proxy_pass http://backends; } }[root@www ~]# systemctl restart nginx |
Access to Nginx Server from a Client to make sure it works normally. |
Sponsored Link |