Could not automatically find a matching server block for 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., so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command: sudo certbot --nginx -d -d

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Cert 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/

What would you like to do?

1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)

Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 1
Keeping the existing certificate
Could not automatically find a matching server block for Set the server_name directive to use the Nginx installer.


  • Unable to install the certificate
  • Congratulations! Your certificate and chain have been saved at:
    Your key file has been saved at:
    Your cert will expire on 2020-09-21. To obtain a new or tweaked
    version of this certificate in the future, simply run certbot again
    with the “certonly” option. To non-interactively renew all of
    your certificates, run “certbot renew”

My web server is (include version): nginx 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:

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):

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

Hi @amarnath


is your job. You have to create a working port 80 server block, so Certbot is able to use that block as template.

Your nginx has a lot of samples how to do that.

1 Like

guide me to create the same.

hello Sir,

Kindly guide me for creating a working port 80 server block

Is there something wrong in below config settings


server {
listen 80;
listen [::]:80;

    root /var/www/prometheus02;
    index index.html index.nginx-debian.html;

    location / {
            try_files $uri $uri/ =404;


Successfully installed my cetificate. but the challenge i am facing is that when i hit the url for the site it show the index.html output. What will may be the issue kindly help sir

prometheus works on x.x.x.x:12321
grafana works on x…x.x.x: 3000
it all works on http. how i can configure both of them on the above port using https.

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