I wonder why rcapache2
(which redirects to systemctl restart apache2.service
) fails with this error, but httpd2 -S
doesn't complain at all:
Jun 28 14:37:50 revue start_apache2[4037]: SSLCertificateFile: file '/etc/apache2/ssl.crt/pluimers.com.crt' does not exist or is empty
I know the certificate should be there (it will in a minute), but I always presumed httpd2 -S
would perform the same checks as systemctl restart apache2.service
would do.
Apparently it doesn't.
SSL is enabled:
# grep APACHE_SERVER_FLAGS /etc/sysconfig/apache2
# 5. To finally enable ssl support, you need to add 'SSL' to APACHE_SERVER_FLAGS
APACHE_SERVER_FLAGS="SSL"
My configuration is based on the apache2-vhost-ssl.template. The template has the below condition. I think the cause is that the condition is satisfied by apache2.service
, but not by httpd2
:
<IfDefine SSL>
<IfDefine !NOSSL>
Is that indeed the cause? If so: why? If not: what is the cause?
How can I work around it using httpd2 -S
?
Running
service
is going to invoke the full init script for apache2 which will be stored in/etc/init.d/apache2
. That script has lots of checks, including checking whether it is already running, that are unlikely to be included in the apachehttpd
itself. You should get in the habit of using theservice
commands to stop and start things. This works across most modern Linuxes.If you want to just check your configuration without starting or stopping anything then you can do
apache2ctl configtest
which if all is well will report:Workaround (as
apache2ctl configtest
didn't work on my system):It will define the SSL switch which is in the
APACHE_SERVER_FLAGS
of/etc/sysconfig/apache2
.One day, I'll write a script that dissects the
APACHE_SERVER_FLAGS
value into multiple-D
parameters.Note so self: right now the prefork is started with these parameters
-f /etc/apache2/httpd.conf -D SSL -D SYSTEMD -D FOREGROUND
.