nginx负载均衡转发https
Posted cyq632694540
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx负载均衡转发https相关的知识,希望对你有一定的参考价值。
A服务器做负载转发到 B,C两台服务器 ;
这时候要添加https域名,则以下是A服务器的nginx配置
upstream backend
server ip;
server ip2;
server
listen 80;
listen 443 ssl;
server_name localhost;
#这个注释掉才能访问http端口
#ssl on;
ssl_certificate /etc/nginx/conf.d/cert/1.crt;
ssl_certificate_key /etc/nginx/conf.d/cert/2.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location /
add_header X-Content-Type-Options nosniff;
proxy_set_header X-Scheme $scheme;
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;
proxy_set_header X-NginX-Proxy true;
proxy_hide_header X-Powered-By;
proxy_hide_header Vary;
proxy_pass http://backend;
proxy_redirect off;
以上是关于nginx负载均衡转发https的主要内容,如果未能解决你的问题,请参考以下文章