I tried to follow up this thread as much as possible but I am always getting this message:

This site can’t be reached

example.com unexpectedly closed the connection.
Checking the connection
Checking the proxy and the firewall

in Chrome.

The part of the configuration I am having is this:

server {   

   listen  80;
   listen 443 default_server ssl;
   #ssl on;

    server_name example.com   www.example.com;

This is for my test website example.com on my local computer.

  • 2
    The thread you mentioned is not for setting https without a certificate. If you want https, you need a certificate.
    – Drifter104
    Apr 5, 2017 at 15:29
  • Thanks, @Drifter104, I solved the problem using the self-signed certificates.
    – prosti
    Apr 5, 2017 at 19:28
  • I don' think the people answering here understand the use case. If people hit your IP address on port 443 using a different URL they will get served the WRONG page in NGINX. I have the same question specifically, because I made a catch all in port 80, but when a browser has the https cached, they route them to the wrong domain, when really I'd like nothing to be served at all. Sep 2, 2020 at 20:13

1 Answer 1


You will have to generate a Self signed certificate or you could look into the Let's Encrypt project to get a free and publicly trusted cert.

HTTPS is for secure traffic, and you can't do the encryption without the cert for the public and private keys.

Adding a link: https://letsencrypt.org/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .