Centos – Why put some config info in conf/httpd.conf and some in files in the conf.d folder

apache-httpdcentosconfiguration

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?

Best Answer

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.

Related Question