0

Recently I bought a SSL certificate on GoDaddy and set it up in my Nginx server like this:

server {
    listen 443 ssl default_server;
    server_name www.mywebsite.example;
    ssl on;
    ssl_certificate /path/to/certificates/mywebsite.example.chained.crt;
    ssl_certificate_key /path/to/certificates/mywebsite.example.key;

    root /var/www/www.mywebsite.example;
    index index.html;
    location / {
            index index.html;
    }
}

I'm using the sample HTML site from Nginx. Previously I did exactly the same with port 80 (without SSL) and I was able to access the site successfully with my domain.

My Nginx server is in a EC2 instance. I made sure that the port 443 has external access and double checked it with sudo netstat -ntlp | grep LISTEN. It shows up like:

tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      24561/nginx: master

Whenever I try to load https://www. mywebsite.example it results in a ERR_CONNECTION_TIMED_OUT error. I don't get anything in the Nginx error logs.

The domain is hosted in Route 53. Am I supposed to manage the DNS records in some way to support HTTPS?

  • IF you get that specific error message it means the DNS resolution has already been done as your browser attempted a connection to a give IP address, but the host at the given IP address did not reply for some time. If you had a DNS problem, you would have another error. There is nothing more to do on the DNS level to have HTTPS if you already have HTTP. There is only something to configure on your webhost, so it is here to troubleshoot. Try connecting locally (from the host to itself), this will rule out any network related issues – Patrick Mevzek Jul 30 at 22:54
  • request the port using curl in the same host. – Shyamin Ayesh Jul 30 at 23:02
  • "I made sure that the port 443 has external access" How, exactly did you do this? – Michael - sqlbot Jul 30 at 23:28
  • There are two rules in my instance's security group for the port 443, one allowing inbound data from 0.0.0.0/0. Moreover it shows up with the command sudo netstat -ntlp | grep LISTEN – puma91 Jul 31 at 14:32
  • If I request a GET to localhost:443 with curl I get a Nginx html error message saying "The plain HTTP request was sent to HTTPS port" – puma91 Jul 31 at 14:34
1

I needed to add a rule to the Ubuntu firewall:

ufw allow 443/tcp

Maybe I have a misconception and the security groups are not the only thing that must be configured to allow external access to the EC2 instance. I didn't have to do this for another server/ssl certificate though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.