If you get the message "502 Bad Gateway" from your nginx reverse proxy but you've checked that your IIS server is reachable and the website is working fine, check that at least one of the websites binded on IIS with HTTPS support is NOT configured with SNI, even if this is not one website that should be accessible from your proxy. Long story short : the following command should return SSL certificate information, even if it is not from the certificate you expect to get in order to get nginx connection to IIS to work: openssl s_client -connect myserver.mynetwork.local:443