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;
}
}