2013-11-03

What is the SUSE equivalent of "httpd -S"?

The short answer, for SLE11: rcapache2 config -S

The short answer, for SLE12: start_apache2 -S

In SUSE/openSUSE, the httpd command is renamed to httpd2, but don't use plain httpd2 -S because it doesn't look in /etc/sysconfig/apache2



I had one virtual host working on my Apache server, but when I tried to add another, I kept getting directed to the first one, even though I had set ServerName properly (or so I thought). The Apache Virtual Hosts documentation told me I could debug my vhost setup by running /usr/local/apache2/bin/httpd -S -- but this doesn't work on SUSE. So, I set off to look for the SUSE equivalent.

First, it's good to know that httpd is the name of the Apache web server binary. When Apache 2.0 came out, version 1 was still in widespread use, so the 2.0 version binaries, packages, etc. were distinguished by adding a '2' at the end. In SUSE and other distributions, "Apache" became "Apache2" and, critically, httpd became httpd2.

Back then, this actually made sense because plenty of folks wanted to have 1.3 and 2.0 co-existing on their systems. In such a scenario, httpd was naturally understood to refer to the 1.3 binary, while httpd2 was the 2.0 binary.

Today, Apache version 1.3 has been EOL for four years already, and the apache package containing Apache version 1.3 has been dropped from SUSE/openSUSE. When we install Apache in SUSE/openSUSE, we actually install the apache2 package and all the important binaries still contain a '2' in their names. Maybe it's time to reconsider this practice.

The official Apache documentation does not use the '2' at all. When it says httpd, it means the 2.0/2.2/2.4 httpd, not the 1.3 httpd.

It's tempting to say that the answer to the question posed by the title of this blog entry is, simply: "the SUSE equivalent is httpd2 -S" - however, this is not really the case because SUSE puts some of the configuration in /etc/sysconfig/apache2, which the upstream binary doesn't take into account. Instead, there are SUSE-specific equivalents:

SLE11: rcapache2 config -S
SLE12: start_apache2 -S

For completeness, let's also look at apache2ctl, since it is relevant to a discussion of how to check one's Apache configuration.

The Apache documentation also mentions a script called apachectl. This, too, is disguised in SUSE/openSUSE -- as apache2ctl, although the manpage is only accessible via the upstream name man apachectl. (By the way, a bug for this is open bnc#873674 and it looks like it will be fixed soon.)

It has a configtest option which can be used to test one's Apache configuration:
# apache2ctl configtest
[Sun Nov 03 13:58:14 2013] [warn] VirtualHost mfile:80 overlaps with VirtualHost mirror:80, 
the first has precedence, perhaps you need a NameVirtualHost directive
Syntax OK

No comments:

Post a Comment