2016-08-13 535 views
1

所以我使用以下設置爲站點創建一個反向代理,如下所示。Nginx反向代理錯誤:14077438:SSL SSL_do_handshake()失敗

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 ""; 
    } 
    } 

但是,得到壞門方法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" 

任何幫助將不勝感激。

回答

1

你的配置有一些奇怪之處。首先你在代理什麼?您是否有服務器名稱爲mysiter.com的另一個服務器模塊在端口443上偵聽,該服務器爲該應用提供服務? 如果是的話,那麼你想要的是301重定向到你的443塊。 如果不是,則代理將在同一個位置塊中出現,形成一個循環(因爲您沒有指定不同的端口)。

您發佈的錯誤是因爲您的上游沒有證書來卸載SSL。爲了解決這個問題,你需要將你的proxy_pass指令改爲純HTTP。

proxy_pass http://mysiter.com/; 

或者您需要提供證書供後端服務器使用。

查看docs瞭解更多信息。 This blog也可能有用。