Error installing cert on nginx

My domain is: wcsdg.com

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

It produced this output:

  • 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 www.wcsdg.com
    Could not automatically find a matching server block for www.wcsdg.com. Set the server_name directive to use the Nginx installer.

But my /etc/nginx/sites-available/wcsdg includes this, and the file is linked in sites-enabled
server {
listen 80;
server_name www.wcsdg.com, wcsdg.com, localhost;

Also, Let's Debug says OK

My web server is (include version): nginx v1.18.0

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

My hosting provider, if applicable, is: Linode

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

I've never seen commas separating the different hostnames in a server_name directive, are you sure commas are allowed? I would recommend removing the commas and just use a single space to separate the hostnames from each other.

2 Likes

OR list the names individually one per line:

server_name www.wcsdg.com;
server_name     wcsdg.com;
server_name     localhost;
1 Like

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