需求:
A服务器的Nginx请求转发到B服务器的 Nginx进行处理,A服务器配置了https证书,B服务器只是配置了域名解析是http的。
配置方案:
A服务器:
server{
listen 443;
server_name xx2.abc.ad.cn;
ssl on;
ssl_certificate /opt/nginx/ssl/xx2.abc.ad.cn.pem;
ssl_certificate_key /opt/nginx/ssl/xx2.abc.ad.cn.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
charset utf-8;
index index.html;
location ^~ /abc/abc3/ {
proxy_pass http://xx.xx.xx.xx:xxxx/xx2/;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://xx.xx.xx.xx:80;
}
}
B服务器:
server {
listen 80;
server_name xx2.abc.ad.cn;
location ^~ /abc/abc3/ {
proxy_pass http://127.0.0.1:xxxx/xx2/;
}
location / {
root /data/xx2/xx2_html;
index index.html index.htm;
}
}
网友评论