Nginx and SSL error: Domain not available

[details=“System Information”]

  • Strapi Version: 3.6.8
  • Operating System: Ubuntu 20.04
  • Database: mysql managed db
  • Node Version: 10.19.0
  • NPM Version: 6.14.4
  • Yarn Version:

Hi!

I am migrating our self hosted CMS from our old servers to a new server. (Apache to a nginx webserver). Right now everything is setup with pm2 and the cms is accessible through the droplet IP and the http version of the custom domain, but whenever I try to listen on port 443, it will time out.

My server block conf:

server {
         listen 80 default_server;
#	 listen [::]:80 default_server;
#       listen 443 ssl default_server;
#       listen [::]:443 ssl;

#       include snippets/ssl-params.conf;

       # ssl_certificate /etc/letsencrypt/live/cms.loyall.co/fullchain.pem;
       # ssl_certificate_key /etc/letsencrypt/live/cms.loyall.co/privkey.pem;

        root /var/www/cms-loyall;

        server_name cms.loyall.co;

        # Proxy Config
        location / {
        proxy_pass http://127.0.0.1:1337;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
    }
}

I did uncomment the listen 443 line for now, since that does not work at all.

I do also have a server.js file in my config:

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  url: 'https://cms.loyall.co',
  proxy: true,
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', '**'),
    },
  },
});

I did try to run npm run build and restart the pm2 process, but this also did not work.