[Certbot Help] I can get a certificate for my domain without the www, but certbot "cannot find a virtual host" matching my domain name WITH a WWW

My website is: www.teatimeteachers.com

I HAD a proper working SSL certificate before, but because of a server crash and loss of backups, I need to start again. This time, Certbot is claiming not to recognize my domain name with the "www." preface. It issued a certificate for the "teatimeteachers.com" but doesn't succeed if I add the domain name "www.teatimeteachers.com"

If anyone has any advice, I could really use it!

Side note:
I'm using wordpress and nginx. This is a pre set-up server hosted on Vultr. It does not include CPanel.

Here's the result:

[root@www ~]# ./certbot-auto --nginx -d www.teatimeteachers.com -d teatimeteachers.com
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/init.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
DeprecationWarning
Saving debug log to /var/log/letsencrypt/letsencrypt.log


You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/teatimeteachers.com.conf)

It contains these names: teatimeteachers.com

You requested these names for the new certificate: www.teatimeteachers.com,
teatimeteachers.com.

Do you want to expand and replace this existing certificate with the new
certificate?

(E)xpand/(C)ancel: e
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for www.teatimeteachers.com
tls-sni-01 challenge for teatimeteachers.com
Cleaning up challenges
Cannot find a VirtualHost matching domain www.teatimeteachers.com.

Not familiar with your exact setup, but maybe order matters...
Try:
./certbot-auto --nginx -d teatimeteachers.com -d www.teatimeteachers.com

If same result, then you may need to find the vhost setting.
Which may include something like:
server_name teatimeteachers.com *.teatimeteachers.com;
or just this:
server_name teatimeteachers.com;

and change it to:
server_name teatimeteachers.com www.teatimeteachers.com;
or this:
server_name teatimeteachers.com www.teatimeteachers.com *.teatimeteachers.com;

I appreciate the help. Unfortunately it didn’t work. :frowning:

I tried re-ordering the command to no avail. And I checked the vhost settings, which see to be defined in the wordpress_http.conf and wordpress_https.conf files. I already included both sites, so I’m still not sure what I’m doing wrong.

Can you please post your nginx configuration here?

@erica, would you be willing to take a look after @TimaFeo posts his configuration to see if it could be a parsing issue?

Wow, thank you so much for the help! You helped me solve it!

It was entirely human error. Go figure. :sweat: I didn’t have the proper separator between the server names in the conf file. Your question made me double check how I added the names, and I tried a few other possibilities and got it working!

In the off chance that anyone else ever runs into this same problem: it was caused by typing in the server name line as:

“server_name www.mydomain.com, mydomain.com;”

All I needed to do was delete the comma…

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