My domain is:
www.*************.pl
I ran this command:
sudo certbot --apache -d example.pl -d www.example.pl
From this manual.
CentOS 7 Install Let’s Encrypt SSL on Apache Server - Shouts.dev
It produced this output:
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: 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.
My web server is (include version):
Server version: Apache/2.4.6 (CentOS)
Server built: Mar 24 2022 14:57:57
The operating system my web server runs on is (include version):
centos-release-7-9.2009.1.el7.centos.x86_64
My hosting provider, if applicable, is:
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 control panel, using console
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you're using Certbot):
certbot 1.11.0
I did some troubleshooting based on previous posts:
]# grep -Ri "Listen 443" /etc/httpd
/etc/httpd/conf.d/ssl.conf:Listen 443 https
ss -tlpn | grep -E ":(80|443)"
LISTEN 0 128 *:80 : users:(("docker-proxy",pid=20606,fd=4))
â httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2022-10-01 13:20:10 CEST; 1h 54min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 20234 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 20234 (code=exited, status=1/FAILURE)
Oct 01 13:20:10 vmi*****.contaboserver.net systemd[1]: Starting The Apache HTTP Server...
Oct 01 13:20:10 vmi******.contaboserver.net httpd[20234]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 01 13:20:10 vmi*****.contaboserver.net httpd[20234]: no listening sockets available, shutting down
Oct 01 13:20:10 vmi*******.contaboserver.net httpd[20234]: AH00015: Unable to open logs
Oct 01 13:20:10 vmi******.contaboserver.net systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 01 13:20:10 vmi*****.contaboserver.net systemd[1]: Failed to start The Apache HTTP Server.
Oct 01 13:20:10 vmi******.contaboserver.net systemd[1]: Unit httpd.service entered failed state.
Oct 01 13:20:10 vmi*****.contaboserver.net systemd[1]: httpd.service failed.
even though my website works, it's wordpress deployed by docker.
I found one of posts on forum how to add virtual host on port 80 but I do no want to mess it up, as I am new to unix, please help. I would really appreciate that. I assume I have to edit apache conf file using VI and add some lines?
JuergenAuer
Hi @tjluoma
check
https://httpd.apache.org/docs/2.4/vhosts/examples.html
Check your configuration file and add something like
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
So Certbot is able to create a SSL-vHost.
I ran also these commands maybe it will help with troubleshooting
[root@v******** ~]# ls -l /etc/apache2/sites-available/
ls: cannot access /etc/apache2/sites-available/: No such file or directory
[root@******** ~]# ls -l /etc/httpd/conf.d/
total 28
-rw-r--r-- 1 root root 2926 Mar 24 2022 autoindex.conf
-rw-r--r-- 1 root root 366 Mar 24 2022 README
-rw-r--r-- 1 root root 9443 Jan 13 2022 ssl.conf
-rw-r--r-- 1 root root 1252 Jan 7 2022 userdir.conf
-rw-r--r-- 1 root root 824 Jan 13 2022 welcome.conf
[root@v******* ~]# ls -l /etc/httpd/sites-enabled/
ls: cannot access /etc/httpd/sites-enabled/: No such file or directory
[root@********* ~]# certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log
No certificates found.
[root@v**** ~]# sudo netstat -pant | grep -i listen | grep -Ei '80|443|apache'
sudo: netstat: command not found
[root@******** ~]# find /etc/httpd -ls
917883 4 drwxr-xr-x 5 root root 4096 Oct 1 13:20 /etc/httpd
917929 0 lrwxrwxrwx 1 root root 19 Oct 1 13:17 /etc/httpd/logs -> ../../var/log/httpd
917911 4 drwxr-xr-x 2 root root 4096 Oct 1 13:34 /etc/httpd/conf.d
917918 4 -rw-r--r-- 1 root root 824 Jan 13 2022 /etc/httpd/conf.d/welcome.conf
917912 4 -rw-r--r-- 1 root root 366 Mar 24 2022 /etc/httpd/conf.d/README
917935 12 -rw-r--r-- 1 root root 9443 Jan 13 2022 /etc/httpd/conf.d/ssl.conf
917916 4 -rw-r--r-- 1 root root 2926 Mar 24 2022 /etc/httpd/conf.d/autoindex.conf
917917 4 -rw-r--r-- 1 root root 1252 Jan 7 2022 /etc/httpd/conf.d/userdir.conf
917931 0 lrwxrwxrwx 1 root root 10 Oct 1 13:17 /etc/httpd/run -> /run/httpd
917930 0 lrwxrwxrwx 1 root root 29 Oct 1 13:17 /etc/httpd/modules -> ../../usr/lib64/httpd/modules
917919 4 drwxr-xr-x 2 root root 4096 Oct 1 13:17 /etc/httpd/conf.modules.d
917920 4 -rw-r--r-- 1 root root 3739 Jan 13 2022 /etc/httpd/conf.modules.d/00-base.conf
917923 4 -rw-r--r-- 1 root root 742 Jan 13 2022 /etc/httpd/conf.modules.d/00-mpm.conf
917925 4 -rw-r--r-- 1 root root 88 Jan 7 2022 /etc/httpd/conf.modules.d/00-systemd.conf
917924 4 -rw-r--r-- 1 root root 957 Jan 13 2022 /etc/httpd/conf.modules.d/00-proxy.conf
917922 4 -rw-r--r-- 1 root root 41 Jan 7 2022 /etc/httpd/conf.modules.d/00-lua.conf
917921 4 -rw-r--r-- 1 root root 139 Jan 7 2022 /etc/httpd/conf.modules.d/00-dav.conf
917936 4 -rw-r--r-- 1 root root 41 Jan 7 2022 /etc/httpd/conf.modules.d/00-ssl.conf
917926 4 -rw-r--r-- 1 root root 451 Jan 7 2022 /etc/httpd/conf.modules.d/01-cgi.conf
917909 4 drwxr-xr-x 2 root root 4096 Oct 1 13:17 /etc/httpd/conf
917928 16 -rw-r--r-- 1 root root 13064 Mar 24 2022 /etc/httpd/conf/magic
917927 12 -rw-r--r-- 1 root root 11753 Jan 13 2022 /etc/httpd/conf/httpd.conf
[root@********** ~]# sudo vi /etc/apache2/apache2.conf
/bin/bash: q: command not found
shell returned 127
Press ENTER or type command to continue
[root@v*******
~]# apachectl -V
Server version: Apache/2.4.6 (CentOS)
Server built: Mar 24 2022 14:57:57
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....