Could not install certificate (installer: nginx))

:~# sudo certbot --nginx -d extunibusbooking.com -d www.extunibusbooking.com -v
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Certificate not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/extunibusbooking.com.conf)

What would you like to do?


1: Attempt to reinstall this existing certificate
2: Renew & replace the certificate (may be subject to CA rate limits)


Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Keeping the existing certificate
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 extunibusbooking.com

Could not automatically find a matching server block for extunibusbooking.com. 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.
help me?

Did you do this by any chance?

1 Like

Yes, I ran the command sudo certbot --nginx -d (my domain name) -d (my domain) -v but encountered an error. Certbot couldn't automatically find a matching server block for (my domain). I'm looking for guidance on how to set the server_name directive correctly.

Even though i set server name in the etc/nginx/sites-available/extunibusbooking.com. its like this: server {
listen 80;
server_name extunibusbooking.com www.extunibusbooking.com;

location / {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $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;
}

# Redirect HTTP to HTTPS
return 301 https://$host$request_uri;

}

server {
listen 443 ssl;
server_name (my domain name) www.mydomain name;

ssl_certificate /etc/letsencrypt/live/extunibusbooking.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/extunibusbooking.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

location / {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $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;
}

}
but still after when i ran sudo certbot --nginx -d mydomainName.com -d www.mydomainName.com, i am meeting the same error.

Usually the active parts of the config are in .../sites-enabled/...

You can review the full nginx active config with below. The uppercase T is essential

sudo nginx -T
2 Likes

Looks like a firewall is dropping my HTTP requests.

2 Likes

it's where i have to set the server name?

You need a server block with server_name for your domain names. That server block needs to be part of the active nginx conf.

Often, there is an include statement in your nginx.conf file for a /sites-enabled/ folder. And, this is a symlink to a file in /sites-available/

But, technically you can use whatever folders you wish. It still needs to be part of the config that nginx knows about. You can see that with nginx -T

You need to learn how nginx is configured. What I am describing is very basic techniques. It is not specific to Let's Encrypt. Your site is not working right now probably because of these kinds of config problems.

You should focus on getting your nginx properly configured and your directories properly setup. The https://nginx.org site is a good reference. Once you can pass the Let's Debug test you can then try to get a certificate.

3 Likes

Thank you, l configured ngnix accordingly & the certificate has been installed successfully.(Enabled https).

1 Like

@lyson, please pick/mark a post as the solution to this problem.

1 Like