0

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?

2 Answers 2

3

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 apache httpd itself. You should get in the habit of using the service 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:

Syntax OK
2
  • I was hoping that httpd2 -S would perform all checks which the service start does, so you can spot configuration issues early. Is there any workaround to have httpd2 -S run a more complete init script before performing checks? Jun 28, 2015 at 13:39
  • It looks like you can get close to the same thing from apache2ctl configtest.
    – chicks
    Jun 28, 2015 at 13:46
0

Workaround (as apache2ctl configtest didn't work on my system):

httpd2 -D SSL -S

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .