I am using Nuxt.js for my projekt with a reverse proxy.
My code without SSL was this here:
server {
server_name mywebsite.at;
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;
}
}
Everything works very well here, but after installing an SSL certificate with certbot i cant access my webpage. I get always an 404 error.
server {
server_name mywebsite.at;
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;
}
location /socket.io/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3000/socket.io/;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mywebsite.at/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mywebsite.at/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 = mywebsite.at) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name mywebsite.at;
return 404; # managed by Certbot
}
I cant figure the issue here.
I think you have a conflicting configuration there. Try removing the
listen 80;
If that doesnt work, try replacing it with
listen 443;
Let me know what it gives
I have found the issue. port 443 was blocked by the firewall. ufw allow 443 fixed the issue
Try test if port 443 is open running ss -ntpl|grep :443, if the port appears in results, You can test from outside running telnet or nc command from another location.
telnet mywebsite.at 443
or
nc -vz -w 1 mywebsite.at 443 # You'll need to install nc before running
Maybe you