0

I have an node.js application that is running on port 3000.

Infront of it i run an nginx reverse proxy. It works fine for port 80. I have tried to install an certificate with certbot. Now i have the certificate and set up my proxy to redirect all non HTTPS traffic to HTTPS and on the port 443 i listent to it and pass my connection to my application. Somehow my browser is pending and i dont know why.

Here i have added 2 server blocks:

server {

    server_name mywebsite.at www.mywebsite.at;
    listen 443 ssl;

    ssl_certificate /etc/letsencrypt/live/mywebsite.at/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mywebsite.at/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
     }
}
server {

    server_name mywebsite.at www.mywebsite.at;
    listen 80;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
     }
}

In this case i can enter http://mywebsite.at but i cant enter https://mywebsite.at. It says "cant reach the website". Any idea why this error appears?

I have runned sudo nginx -t there are no erros. If i write netstat -plnt | grep 443 i get:

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

Can somebody help me here ?

bill.gates
  • 101
  • 4

1 Answers1

0

I have found the issue. Port 443 was blocked, with ufw allow 443 i fixed the problem.

bill.gates
  • 101
  • 4