Could not automatically find a matching server block for galaeyelashes.in. Set the `server_name` directive to use the Nginx installer

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: galaeyelashes.in

I ran this command: sudo certbot --nginx -d galaeyelashes.in -d www.galaeyelashes.in

It produced this output: `Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/galaeyelashes.in/fullchain.pem
Key is saved at: /etc/letsencrypt/live/galaeyelashes.in/privkey.pem
This certificate expires on 2024-03-06.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Could not install certificate

NEXT STEPS:

  • The certificate was saved, but could not be installed (installer: nginx). After fixing the error shown below, try installing it again by running:
    certbot install --cert-name galaeyelashes.in

Could not automatically find a matching server block for galaeyelashes.in. Set the server_name directive to use the Nginx installer.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.`

My web server is (include version): Ubuntu 22.04 64bit with CloudPanel

The operating system my web server runs on is (include version): Ubuntu 22.04 64bit

My hosting provider, if applicable, is: Hostinger

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

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

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

my /etc/nginx/sites-available/galaeyelashes.in file

server {
    listen 80;
    server_name galaeyelashes.in www.galaeyelashes.in;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name galaeyelashes.in www.galaeyelashes.in;

    ssl_certificate /etc/letsencrypt/live/galaeyelashes.in/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/galaeyelashes.in/privkey.pem;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

A couple things ...

First, right now your port 80 and port 443 are closed so HTTP and HTTPS requests fail. Port 80 at least must have been working to get a cert like you requested.

Ignoring that, there might be confusion about whether your nginx server blocks are defined in sites-available or sites-enabled. They normally have a symlink in -enabled to the ones in -available.

Can you show this

ls -lR /etc/nginx/sites* 
2 Likes

Is that file also available from /etc/nginx/sites-enabled? Usually a symbolic link to the corresponding file in sites-available is used.

Edit: I see Mike also addressed that part.

That said, it looks like you've already configured nginx manually? So I'm not sure what your question is exactly: why would you want Certbot to install the certificate for you if you already configured nginx manually?

2 Likes

This could use an update:

See: Certbot (eff.org)

Also, please show the full nginx running config, with:

nginx -T

2 Likes

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