Nginx – Set Nginx https (on port 443) without the certificate

certificatehttpsnginxssl-certificate

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.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_CLOSED
ReloadHIDE DETAILS

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 127.0.0.1 computer.

Best Answer

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/