首页 > 其他 > 详细

nginx 80和443同时做负载均衡

时间:2018-08-08 19:51:13      阅读:308      评论:0      收藏:0      [点我收藏+]
nginx 80和443同时做负载均衡:

vi /etc/nginx/conf.d/default.conf

upstream bugqa.ming.com {
server 10.0.0.3:80;
server 10.0.0.4:80;
}

server {
    listen 80;
    location / {
             proxy_pass http://bugqa.ming.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;
               }

                      server {
    listen 443;

             ssl on;
     ssl_certificate ming.com/ming.crt;
     ssl_certificate_key ming.com/ming.key;

    location / {
             proxy_pass http://bugqa.ming.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;
               }             

:wq

service nginx restart

验证:

浏览器访问http://bugqa.ming.com 和 https://bugqa.ming.com

nginx 80和443同时做负载均衡

原文:http://blog.51cto.com/yangzhiming/2156469

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!