Question

Certbot verification fails

Certbot returns the error:

Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.

This is after a fresh install. I’m keeping it simple and not using any virtual hosts, etc. Just a few pages in the /var/www/html directory. httpd is enabled and I can access the website in my browser.

What am I doing wrong?

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
February 21, 2018
Accepted Answer

As far as I know, Certbot supports virtual hosts only, so it won’t be able to proceed if you don’t have any configured. Try adding a basic virtual host like so and see if that helps:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Also don’t forget to a2ensite 000-default

In case anyone else runs into this: I’ve run into this problem before (and again today); apache is endlessly configurable, and the certbot apache module is not able to cope with every configuration. I have the document root for various virtual hosts in different directories. Even though apache is quite happy with this, the certbot module is not always happy. I solved my problem using the --apache-vhost-root option:

certbot --apache certonly --apache-vhost-root /var/www/html/www

and it solved my problem. For help see:

certbot --help apache

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.