Nginx反向代理错误:14077438:SSL SSL_do_handshake()失败

35

所以我正在使用以下设置来创建下面站点的反向代理。

  server {
     listen 80;
     server_name mysite.com;
     access_log  /var/log/nginx/access.log;
     error_log  /var/log/nginx/error.log;
     root /home/ubuntu/p3;
   location / {
     proxy_pass  https://mysiter.com/;
     proxy_redirect  https://mysiter.com/ $host;
     proxy_set_header Accept-Encoding "";
    }
  }

但是遇到 BAD GATE WAY 502 错误,以下是日志。

2016/08/13 09:42:28 [error] 26809#0: *60 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 103.255.5.68, server: mysite.com, request: "GET / HTTP/1.1", upstream: "https://105.27.188.213:443/", host: "mysite.com"
2016/08/13 09:42:28 [error] 26809#0: *60 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 103.255.5.68, server: mysite.com, request: "GET / HTTP/1.1", upstream: "https://105.27.188.213:443/", host: "mysite.com"

非常感谢任何帮助。

2个回答

76

无法使用Cloudflare吗?- DNS指向被禁止的IP错误1000 - undefined

7
你的配置有几个奇怪的地方。首先,你要代理到哪里?你有另一个服务器块,服务器名称为mysiter.com,监听端口443并提供应用程序吗? 如果是,则你需要在这里进行301重定向到你的443块。 如果没有,则代理将落入相同的位置块,形成一个循环(因为你没有指定不同的端口)。
你发布的错误是因为你的上游没有证书来卸载SSL。要解决这个问题,你需要将proxy_pass指令更改为普通HTTP。
proxy_pass  http://mysiter.com/;

否则,您需要提供证书供后端服务器使用。

查看文档以获取更多信息。这篇博客也可能有所帮助。


谢谢您的回答 - 在代理_pass参数中仅使用http而不是第二个https对我有用。我已经设置了proxy_ssl_server_name on - lorem monkey
对我来说这个代理很有效 proxy_pass http://xxx.de. 你现在必须处理它。也许与HTTP/2有关? - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接