Cannot find a virtualhost matching domain

Following the instructions here, I can’t get certbox to register my domain.

My domain is:

I ran this command:
sudo certbot --nginx -d -d
I’ve used variations - sometimes only entering … -d, -d, changing order …

It produced this output:
greg@joeiii:~$ sudo certbot --nginx -d -d
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Starting new HTTPS connection (1):
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for
tls-sni-01 challenge for
Cleaning up challenges
Cannot find a VirtualHost matching domain

My web server is (include version):
Nginx 1.10.3

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

My hosting provider, if applicable, is:
Digital Ocean

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):
Partially. Here’s a screencap of my domain configuration on

I’m handling updates and improving security from the shell.
I’m using Ghost 0.11.1.

Can you post (perhaps through the /var/log/letsencrypt/letsencrypt.log file?

It seems to me certbot is using the apache plugin, even though you’ve specified --nginx

I have several letsencrypt.log files. Presumably one for every time I’ve run certbot. Some of them are empty, I can’t even access the folder unless I’m root. $ su won’t work.

this is letsencrypt.log.1 (of 22)

Could you also post the nginx configuration file that defines the virtual host for those domain names? Are you using the default structure for nginx configuration on your operating system, or did you change or rewrite the nginx configuration in some way?

Here it is:

I’m using Digital Ocean’s Ubuntu 16.04 One-click Ghost (0.11.1) installation.
I’ve added a new user with root permissions and tried to get this cert working, and that’s about it.

@erica, can you see a reason why Certbot would have trouble finding the virtual host here? It’s Certbot 0.17.

Does my UFW status help?

22 LIMIT Anywhere
443 ALLOW Anywhere
80 ALLOW Anywhere
Nginx Full ALLOW Anywhere
OpenSSH ALLOW Anywhere
22 (v6) LIMIT Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)

Nope, the problem has to do with your nginx configuration (in terms of the actual configuration file parsing). It’s not a network error, but a configuration parsing error — which could potentially be a problem with Certbot rather than your configuration.

Nothing out of the ordinary so far.

Is your nginx.conf file located in /opt/nginx/conf/ or /etc/nginx/?

If it’s in /etc/nginx/, could you post the contents of /etc/nginx/nginx.conf, and the results of tree /etc/nginx?

It’s at /etc/nginx/nginx.conf,
Here’s the contents:

And tree returns:
├── conf.d
├── fastcgi.conf
├── fastcgi_params
├── koi-utf
├── koi-win
├── mime.types
├── nginx.conf
├── proxy_params
├── scgi_params
├── sites-available
│ ├── default
│ └── ghost
├── sites-enabled
│ └── default -> /etc/nginx/sites-available/ghost
├── snippets
│ ├── fastcgi-php.conf
│ └── snakeoil.conf
├── uwsgi_params
└── win-utf

Thanks! And the file contents you posted earlier is /etc/nginx/sites-available/ghost? Or is it /etc/nginx/sites-available/default?

I’ve been showing you /etc/nginx/sites-available/default, not

Replacing the ip address with the domains in the server block in the latter did it!

Thank you @schoen and @erica !

You’re welcome, glad you got things working!

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