In a previous blog we achieved load balancing using Docker's official Nginx mirroring, which is not easy to use, and uses my own mirrors: Chenyufeng/nginx-centos to achieve load balancing. It will be more convenient to use Chenyufeng/nginx-centos mirroring to match the configuration of Nginx on Linux.
The/usr/local/nginx/conf/nginx.conf configuration is as follows:
#user nobody; Worker_processes 1;
#error_log Logs/error.log; #error_log Logs/error.log Notice; #error_log Logs/error.log Info;
#pid Logs/nginx.pid;
Events {worker_connections 1024;}
HTTP {include mime.types; Default_type Application/octet-stream;
#log_format Main ' $remote _addr-$remote _user [$time _local] "$request" ' # ' $status $body _bytes_sen T "$http _referer" "$http _user_agent" "$http _x_forwarded_for";
#access_log Logs/access.log Main;
Sendfile on; #tcp_nopush on;
#keepalive_timeout 0; Keepalive_timeout 65;
#gzip on;
# key steps Upstream backend {server 192.168.0.101:8080; Server 192.168.0.101:8081; }
server {Listen 80; server_name localhost;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Location/{# key steps Proxy_pass http://backend; }
#error_page 404/404.html;
# REDIRECT Server error pages to the static page/50x.html # Error_page 502 503 504/50x.html; Location =/50x.html {root html; }
# Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ {# Proxy_pass http://127.0.0.1; #}
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ {# R Oot html; # Fastcgi_pass 127.0.0.1:9000; # Fastcgi_index index.php; # Fastcgi_param Script_filename/scripts$fastcgi_script_name; # include Fastcgi_params; #}
# Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' one # #location ~/\.ht {# deny all; #} }
# Another virtual host using mix of ip-, name-, and port-based configuration # #server {# Listen 800 0; # Listen somename:8080; # server_name somename alias Another.alias;
# location/{# root HTML; # index index.html index.htm; # } #}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.