Nginx reverse proxy error:14077438:SSL SSL_do_handshake() failed
Nginx reverse proxy error:14077438:SSL SSL_do_handshake() failed
所以我使用以下设置为站点创建一个反向代理,如下所示。
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"
任何帮助将不胜感激。
您的配置有些奇怪。首先你要代理什么?您是否有另一个服务器名称为 mysiter.com
的服务器块侦听为应用程序提供服务的端口 443?
如果是,那么您在这里想要的是 301 重定向到您的 443 块。
如果没有,那么代理将登陆同一个位置块,形成一个循环(因为你没有指定不同的端口)。
您发布的错误是因为您的上游没有卸载 SSL 的证书。要解决此问题,您需要将 proxy_pass
指令更改为纯 HTTP。
proxy_pass http://mysiter.com/;
或者您需要提供证书供后端服务器使用。
在 Nginx 1.9.0 上看到完全相同的错误,看起来它是由使用 SNI 的 HTTPS 端点引起的。
将此添加到代理位置修复了它:
proxy_ssl_server_name on;
所以我使用以下设置为站点创建一个反向代理,如下所示。
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"
任何帮助将不胜感激。
您的配置有些奇怪。首先你要代理什么?您是否有另一个服务器名称为 mysiter.com
的服务器块侦听为应用程序提供服务的端口 443?
如果是,那么您在这里想要的是 301 重定向到您的 443 块。
如果没有,那么代理将登陆同一个位置块,形成一个循环(因为你没有指定不同的端口)。
您发布的错误是因为您的上游没有卸载 SSL 的证书。要解决此问题,您需要将 proxy_pass
指令更改为纯 HTTP。
proxy_pass http://mysiter.com/;
或者您需要提供证书供后端服务器使用。
在 Nginx 1.9.0 上看到完全相同的错误,看起来它是由使用 SNI 的 HTTPS 端点引起的。
将此添加到代理位置修复了它:
proxy_ssl_server_name on;