准备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/”
部署
- docker-compose
version:'3'services:nginx:container_name: nginx
image: nginx
restart: always
volumes:- ./default.conf:/etc/nginx/conf.d/default.conf
ports:- 10001:80privileged:true
版权归原作者 Mr.Lee jack 所有, 如有侵权,请联系我们删除。