12

The main apache config file is in /etc/httpd/conf/httpd.conf on my CentOS system an in there is a line:

Include conf.d/*.conf

Inside conf.d is mostly files that do something like this:

LoadModule auth_kerb_module modules/mod_auth_kerb.so

But there are also other sites that are setup in there to and have their own config files. Was this not well thought out or am I missing something?

3 Answers 3

8

Separating configuration files is a way to manage them. By putting configuration lines specific to a module into their own files it become much easier to enable and disable modules. It also helps managing them, because now you only have a small configuration file to edit. (Imagine opening up a 500 line httpd.conf and looking for an incorrect option.)

Different systems seem to have different ways to separate apache configuration files. For example on my Gentoo there are modules.d/ and vhosts.d/, while on my Ubuntu there are conf.d/, mods-available/, mods-enabled/, sites-available/ and sites-enabled/. You can guess what they do by the name, or look inside httpd.conf for Include lines.

3

Since there are several packages that can provide functionality to Apache's HTTPd, the base package installs an httpd.conf that provides most of the basic settings, and other packages, such as mod_ssl, nagios and php have configuration files that need to be included per-package. The Red Hat packagers use the conf.d directory to drop the configuration in for those packages, otherwise they'd need to modify the httpd.conf for each package, which is something difficult to automate during package installation.

0

I've found that there's not a very well documented specification on where exactly what configuration files go in apache. Especially since they've recently changed how the default does it. Did you install from source or from a package? Packages, especially debian packages, seem to not follow the apache source at all.

It's been a while since I've done much with apache, but if I remember, conf.d/ is where you would put loading the daemon modules like what you've posted, or ffi or stuff like that.

While conf/ is where site specific configuration files go.

This is what mine looks like, this is installed from source.

 % ll /opt/apache2
drwxr-xr-x  2 root 4.0K 2010-10-25 14:14 bin/
drwxr-xr-x  2 root 4.0K 2010-10-25 14:14 build/
drwxr-xr-x  2 root 4.0K 2010-10-25 14:14 cgi-bin/
drwxr-xr-x  4 root 4.0K 2010-10-28 15:54 conf/
drwxr-xr-x  3 root 4.0K 2010-10-25 14:14 error/
drwsrwxrwx  3 www  4.0K 2010-10-28 13:06 htdocs/
drwxr-xr-x  3 root 4.0K 2010-10-25 14:14 icons/
drwxr-xr-x  2 root 4.0K 2010-10-25 14:14 include/
drwxr-xr-x  3 root 4.0K 2010-10-25 14:14 lib/
drwxr-xr-x  3 root 4.0K 2010-10-28 16:11 logs/
drwxr-xr-x  4 root 4.0K 2010-10-25 14:14 man/
drwxr-xr-x 14 root  12K 2010-10-14 11:45 manual/
drwxr-xr-x  2 root 4.0K 2010-10-25 14:20 modules/
 % ll /opt/apache2/conf
total 88K
drwxr-xr-x 2 root 4.0K 2010-10-28 15:55 extra/
drwxr-xr-x 3 root 4.0K 2010-10-25 14:14 original/
-rw-r--r-- 1 root  14K 2010-10-28 15:54 httpd.conf
-rw-r--r-- 1 root  13K 2010-10-25 14:14 magic
-rw-r--r-- 1 root  45K 2010-10-25 14:14 mime.types



% ll /opt/apache2/conf/extra
total 60K
-rw-r--r-- 1 root  179 2010-10-28 15:31 20_mod_fastcgi.conf
-rw-r--r-- 1 root 2.8K 2010-10-25 14:14 httpd-autoindex.conf
-rw-r--r-- 1 root 1.7K 2010-10-25 14:14 httpd-dav.conf
-rw-r--r-- 1 root 2.3K 2010-10-25 14:14 httpd-default.conf
-rw-r--r-- 1 root 1.1K 2010-10-25 14:14 httpd-info.conf
-rw-r--r-- 1 root 5.0K 2010-10-25 14:14 httpd-languages.conf
-rw-r--r-- 1 root  906 2010-10-25 14:14 httpd-manual.conf
-rw-r--r-- 1 root 3.8K 2010-10-25 14:14 httpd-mpm.conf
-rw-r--r-- 1 root 2.2K 2010-10-25 14:14 httpd-multilang-errordoc.conf
-rw-r--r-- 1 root  10K 2010-10-25 14:14 httpd-ssl.conf
-rw-r--r-- 1 root  817 2010-10-25 14:14 httpd-userdir.conf
-rw-r--r-- 1 root 1.8K 2010-10-28 15:55 httpd-vhosts.conf

But also note that this isn't a live server and I built this apache install specifically to test Wt

1

You must log in to answer this question.

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