0

I'm brand new to AWS and web servers, using nginx for this project & MERN stack for the code. Anyways I got my website up and running using this tutorial, and used this tutorial (uses letsencrypt and certbot) to try to add SSL to my website, which was working fine in standard http. Now when I attempt to access the site it times out and chrome shows This site can’t be reached www.instaspots.net took too long to respond.

My nginx config file looks like

  server_name instaspots.net;
add_header Content-Security-Policy upgrade-insecure-requests;

  # react app & front-end files
  location / {
    root /opt/frontend/build;
    try_files $uri /index.html;
  }

  # node api reverse proxy
  location /items/ {
    proxy_pass http://localhost:4000/;
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/instaspots.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/instaspots.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    server_name www.instaspots.net; # managed by Certbot
add_header Content-Security-Policy upgrade-insecure-requests;

  # react app & front-end files
  location / {
    root /opt/frontend/build;
    try_files $uri /index.html;
  }

  # node api reverse proxy
  location /items/ {
    proxy_pass http://localhost:4000/;
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/instaspots.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/instaspots.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



}server {
    if ($host = instaspots.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


  listen 80 default_server;
  server_name instaspots.net;
    return 404; # managed by Certbot


}server {
    if ($host = www.instaspots.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


  listen 80 ;
    server_name www.instaspots.net;
    return 404; # managed by Certbot


}

sudo netstat -plnt | grep nginx returns

tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      62312/nginx: master 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      62312/nginx: master 

which all seems fine, but someone else debugging this used nc -zv instaspots.net 443 but when I try that it returns connectx to instaspots.net port 443 (tcp) failed: Operation timed out leading me to believe this may help point to the problem. Unfortunately my debugging skills are lacking when it comes to sysadmin things, so if anyone could guide me on debugging this I would be very thankful.

0

You have to open port 443 in your AWS security group.

| improve this answer | |

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.