Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Why does Apache2 have multiple configuration files? What are their roles? I found some information about older Apache versions, but it's usually deprecated, and the official Apache documentation doesn't explain the logic of splitting up the configuration files and what they're for

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Hmm. From one point of view, you can dump all the configuration into one httpd.conf file, but this would be... hard to read.

Most distros will divide up the configuration by having httpd.conf include subdirectories. You may want to look at distro-specific documentation, for example:

https://help.ubuntu.com/12.04/serverguide/httpd.html

For Ubuntu, the Apache configuration directory is /etc/apache2. The primary subdirectories for your organizational convenience are conf.d, mods-available, mods-enabled, sites-available and sites-enabled. You would keep your module configuration in the mods-available directory, and your virtualhost configurations in the sites-available directory. Note that the *-enabled directories contain symlinks to the corresponding *-available directories, so you can keep a bunch of things floating around in *-available, but only activate them by symlinking from the *-enabled directory. The master httpd.conf file will do an include of what's in the *-enabled directories.

RHEL/CentOS doesn't work that way, and leave it somewhat more up to your discretion on how to set up the /etc/httpd base directory. You can dump everything into /etc/httpd.conf; you can create a similar directory structure to Ubuntu (and modify httpd.conf to include the *-available directories that you've made), or some combination thereof.

So, you may want to check your distro's documentation first. As you'll see with the Ubuntu one, they provide links to other resources.

share|improve this answer
1  
To complement this answer, the document DistrosDefaultLayout explains the differences among distros regarding the layout of config files for Apache. –  nozimica Jan 25 '13 at 17:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.