Unable to get https working on my new site

My domain is: sudhirkhanger.com

I ran this command: sudo certbot --nginx -d sudhirkhanger.com -d www.sudhirkhanger.com

It produced this output: successful installation

My web server is (include version): nginx/1.14.0 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 18.04

My hosting provider, if applicable, is: Lightsail

I can login to a root shell on my machine (yes or no, or I don’t know): yes

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): certbot 0.31.0

I installed LEMP + WordPress + Certbot as per DigitalOcean guide but I am unable reach my server after installing Letsencrypt certificate.

server {
        root /var/www/sudhirkhanger.com/public_html;
        
        index index.php index.html index.htm index.nginx-debian.html;

        server_name sudhirkhanger.com www.sudhirkhanger.com;

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico { log_not_found off; access_log off; }
        location = /robots.txt { log_not_found off; access_log off; allow all; }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
            expires max;
            log_not_found off;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/sudhirkhanger.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sudhirkhanger.com/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 = www.sudhirkhanger.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

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

        listen 80 default_server;
        listen [::]:80 default_server;

        server_name sudhirkhanger.com www.sudhirkhanger.com;
    return 404; # managed by Certbot
}
1 Like

Did you open port 443 in every firewall?

2 Likes

Firewall is inactive.

$ sudo ufw status
Status: inactive

Please check your Lightsail firewall.

2 Likes

Thank you that was it.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.