Nngix反向代理https站点

需求:现在有一业务A访问地址为,现在要上线B业务,访问地址为/ent,"ent"对应的服务在另外一台服务器上,使用的域名为,该域名

环境 nginx-2.3.0

配置:

server { listen 80; server_name www.test.com; root /www/www.test.com; index index.html; access_log /logs/www.test.com/access.log main; location ^~ /ent { proxy_ssl_certificate ssldir/ent.abc.com.pem; 证书目录 proxy_ssl_certificate_key ssldir/ent.abc.com.key; 秘钥目录 proxy_ssl_trusted_certificate /etc/pki/tls/certs/ca-bundle.trust.crt;指定可信CA证书,用于验证 证书 proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 控制使用的协议 proxy_ssl_ciphers HIGH:!aNULL:!MD5; 秘钥算法 proxy_ssl_verify off; 验证证书的有效性 proxy_ssl_verify_depth 2; 指定了证书链检查的深度 proxy_ssl_session_reuse on;确定在使用代理服务器时是否可以重用SSL会话 proxy_set_header Cookie $http_cookie; proxy_set_header Host "ent.abc.com"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass /; 后端地址 proxy_connect_timeout 300s; 后端服务器连接超时时间 proxy_send_timeout 300s; 设置将请求传输到代理服务器的超时。仅在两个连续的写操作之间设置超时,而不是为整个请求的传输。如果代理服务器在此时间内未收到任何内容,则关闭连接。 proxy_read_timeout 300s;定义从代理服务器读取响应的超时。仅在两个连续的读操作之间设置超时,而不是为整个响应的传输。如果代理服务器在此时间内未传输任何内容,则关闭连接。 } }

验证

使用访问A业务;

使用/ent访问B业务;