nginx 80和443同時做負載均衡
阿新 • • 發佈:2018-08-08
ups art 均衡 負載均衡 follow service cert 同時 remote 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同時做負載均衡