Linux : Nginx error SSL_do_handshake() failed while SSL handshaking to upstream

By | February 15, 2015

Using Nginx as Apache reverse proxy and receiving “502 Bad Gateway” error and, additionally have something like this in your error log file?

[error] SSL_do_handshake() failed (SSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol) while SSL handshaking to upstream, client:, server: www.domain.tld, request: “GET / HTTP/1.1”, upstream: “”, host: “www.domain.tld”

Since you are using SSL, you obviously need dedicated IP address per vHost (this example clearly show the request has been sent to the localhost IP! You probably have the wrong IP set in proxy_pass statement).

1. Make sure the Apache vHost/site is responding on the non-standard port (browse to : https://www.domain.tld:4343).

2. If this is loading properly, then note the IP address contained within <VirtualHost> of your SSL vHost, otherwise double check your Apache configuration.

3. Under your Nginx SSL vHost configuration, make sure the same IP address is in that statement “proxy_pass;“.