Changing servers from apache to nginx, Unable to install the certificate

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

It produced this output:
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-03-04. 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”
    [root@dxpdemo ~]# Set the server_name directive to use the Nginx installer.

My web server is (include version):
nginx (whatever version it is from yum install nginx)

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

My hosting provider, if applicable, is:

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

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):
certbot-auto --version
certbot 1.1.0

1 Like

This is good:

This is … well maybe something you need to do manually (at least the first time).

So... Let's get that cert installed!
Please show the vhost config that would be using that cert.
OR the complete nginx config is not too big.
nginx -T

1 Like

I resolved this by putting the server name instead of localhost
server {
server_name localhost;

I changed localhost to my signed certificate domain name


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