准备nginx
- 这里准备官方nginx镜像
docker pull nginx:latest
配置default.conf
server {
listen 80;
server_name localhost;
location / {
proxy_pass https://xxx.com/;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_ssl_verify off;
proxy_ssl_server_name on;
proxy_ssl_session_reuse off;
}
}
上诉示例中,如果是https,proxy_ssl_session_reuse ,proxy_ssl_server_name ,这两个没有会报ssl SSL_do_handshake() failed
SSL_do_handshake() failed (SSL: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:SSL alert number 40) while SSL handshaking to upstream, client: 127.0.0.1, server: 127.0.0.1, request: “POST /api/test HTTP/1.1”, upstream: “https://xxxx”, host: “127.0.0.1”, referrer: “http://127.0.0.1/”
no live upstreams while connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request: “POST /api/test HTTP/1.1”, upstream: “https://xxxx”, host: “127.0.0.1”, referrer: “http://127.0.0.1/”文章来源地址https://www.toymoban.com/news/detail-535110.html
部署
- docker-compose
version: '3'
services:
nginx:
container_name: nginx
image: nginx
restart: always
volumes:
- ./default.conf:/etc/nginx/conf.d/default.conf
ports:
- 10001:80
privileged: true
文章来源:https://www.toymoban.com/news/detail-535110.html
到了这里,关于nginx如何代理转发第三方https网站的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!