当前位置:

nginx代理转发第三方httphotoshop网站

访客 2024-01-05 655 0

准备nginx

  • 这里准备官方nginx镜像
dockerpullnginx:latest

配置default.conf

server{listen80;server_namelocalhost;location/{proxy_passhttps://xxx.com/;#proxy_set_headerX-Real-IP$remote_addr;#proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;#proxy_set_headerX-Forwarded-Proto$scheme;#proxy_ssl_verifyoff;proxy_ssl_server_nameon;proxy_ssl_session_reuseoff;}}

上诉示例中,如果是https,proxy_ssl_session_reuse,proxy_ssl_server_name,这两个没有会报sslSSL_do_handshake()failed
SSL_do_handshake()failed(SSL:error:14094410:SSLroutines:ssl3_read_bytes:sslv3alerthandshakefailure:SSLalertnumber40)whileSSLhandshakingtoupstream,client:127.0.0.1,server:127.0.0.1,request:“POST/api/testHTTP/1.1”,upstream:“https://xxxx”,host:“127.0.0.1”,referrer:“http://127.0.0.1/”
noliveupstreamswhileconnectingtoupstream,client:127.0.0.1,server:127.0.0.1,request:“POST/api/testHTTP/1.1”,upstream:“https://xxxx”,host:“127.0.0.1”,referrer:“http://127.0.0.1/”

部署

  • docker-compose
version:'3'services:nginx:container_name:nginximage:nginxrestart:alwaysvolumes:-./default.conf:/etc/nginx/conf.d/default.confports:-10001:80privileged:true

发表评论

  • 评论列表
还没有人评论,快来抢沙发吧~