nginx负载均衡

nginx负载均衡,第1张

nginx负载均衡

nginxserver01: 192.168.161.130$ vi /etc/yum.repos.d/nginx.repo[nginx]name=nginx repobaseurl=https://nginx.org/packages/centos/7/$basearchgpgcheck=0enabled=1$ yum makecache$ yum -y install nginx$ vi /usr/share/nginx/html/index.html

########################

cloud1801!

###########################

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.

Commercial support is available atnginx.com.

Thank you for using nginx.

nginxwebserver02: 192.168.161.131upstream: 192.168.161.129

$ vi /etc/yum.repos.d/nginx.repo[nginx]name=nginx repobaseurl=https://nginx.org/packages/centos/7/$basearchgpgcheck=0enabled=1$ yum makecache$ yum -y install nginx$ vi /usr/share/nginx/html/index.html########################

cloud1802!

###########################

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.

Commercial support is available atnginx.com.

Thank you for using nginx.

$ vi /etc/yum.repos.d/nginx.repo[nginx]name=nginx repo任务:baseurl=https://nginx.org/packages/centos/7/$basearchgpgcheck=0enabled=1$ yum makecache$ yum -y install nginx$ mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak$ vi /etc/nginx/nginx.confhttp {include /etc/nginx/mime.types;default_type application/octet-stream;log_format main '$remote_addr - $remote_user [$time_local] "$request"''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log /var/log/nginx/access.log main;sendfile on;#tcp_nopush on;keepalive_timeout 65;#gzip on;include /etc/nginx/conf.d/*.conf;####以下为增加的内容####upstream webserver {#ip_hash; ##会话保持功能server 192.168.161.130:80; ##weight可以设置权重值server 192.168.161.131:80;}server {listen 80;server_name localhost;location / {proxy_pass https://webserver;}}####以上为增加的内容####}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/531105.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2019-08-14
下一篇 2019-08-14

发表评论

登录后才能评论

评论列表(0条)

保存