Error while running apachectl graceful - Unable to find a virtual host listening on port 80

Hi, Please help for this error!

I ran this command:

certbot --apache -d mydomain.com

or

./letsencrypt-auto --apache -d mydomain.com

It produced this output:

`Saving debug log to /var/log/letsencrypt/letsencrypt.log`
`Plugins selected: Authenticator apache, Installer apache`
`Starting new HTTPS connection (1): ` `acme-v02.api.letsencrypt.org`
`Obtaining a new certificate`
`Performing the following challenges:`
`http-01 challenge for ` `mydomain.com`
`Cleaning up challenges`
`Error while running apachectl graceful.` `Job for httpd.service invalid.` `Unable to restart apache using ['apachectl', 'graceful']`
`Error while running apachectl restart.` `Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.` `Encountered exception during recovery:`
`Traceback (most recent call last):`
`  File "/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.py", line 125, in _call_registered`
`    self.funcs[-1]()`
`  File "/usr/lib/python2.7/site-packages/certbot/_internal/auth_handler.py", line 243, in _cleanup_challenges`
`    self.auth.cleanup(achalls)`
`  File "/usr/lib/python2.7/site-packages/certbot_apache/_internal/configurator.py", line 2540, in cleanup`
`    self.restart()`
`  File "/usr/lib/python2.7/site-packages/certbot_apache/_internal/configurator.py", line 2410, in restart`
`    self._reload()`
`  File "/usr/lib/python2.7/site-packages/certbot_apache/_internal/configurator.py", line 2437, in _reload`
`    raise errors.MisconfigurationError(error)`
`MisconfigurationError: Error while running apachectl restart.` `Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.` `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.Saving debug log to /var/log/letsencrypt/letsencrypt.log`
`Plugins selected: Authenticator apache, Installer apache`
`Starting new HTTPS connection (1): ` `acme-v02.api.letsencrypt.org`
`Obtaining a new certificate`
`Performing the following challenges:`
`http-01 challenge for ` `mydomain.com`
`Cleaning up challenges`
`Error while running apachectl graceful.` `Job for httpd.service invalid.` `Unable to restart apache using ['apachectl', 'graceful']`
`Error while running apachectl restart.` `Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.` `Encountered exception during recovery:`
`Traceback (most recent call last):`
`  File "/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.py", line 125, in _call_registered`
`    self.funcs[-1]()`
`  File "/usr/lib/python2.7/site-packages/certbot/_internal/auth_handler.py", line 243, in _cleanup_challenges`
`    self.auth.cleanup(achalls)`
`  File "/usr/lib/python2.7/site-packages/certbot_apache/_internal/configurator.py", line 2540, in cleanup`
`    self.restart()`
`  File "/usr/lib/python2.7/site-packages/certbot_apache/_internal/configurator.py", line 2410, in restart`
`    self._reload()`
`  File "/usr/lib/python2.7/site-packages/certbot_apache/_internal/configurator.py", line 2437, in _reload`
`    raise errors.MisconfigurationError(error)`
`MisconfigurationError: Error while running apachectl restart.` `Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.` `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.

`

CentOS 7.8.2003 | Apache 2.4.46

certbot 1.7.0

1 Like

You might have more than one certbot installed.
which certbot
then
^that output^ --version

[please show both outputs]

1 Like