Ubuntu Apache: httpd.conf or apache2.conf?

Solution 1:

The httpd.conf is designed for user configurations. You really should not edit the apache2.conf as it may be updated by future upgrades.

An additional option is to just put your custom configuration into /etc/apache2/conf.d, all files in this directory are included as well.

Solution 2:

These are not your only options. On Ubuntu/Debian, Apache also processes all the files in /etc/apache2/sites-enabled/ (which should be symlinks to files in sites-available/ directory, managed by the a2ensite and a2dissite programs)

You're intended to use these directories for VirtualHosts.


Solution 3:

apache2.conf includes httpd.conf:

a@test$:/etc/apache2$ cat apache2.conf | grep httpd.conf 
Include /etc/apache2/httpd.conf

I think that httpd.conf is deprecated, but just left in there for conservative people so that they find they way around... :)

EDIT:

After reading Rob's answer, I did a better grep:

a@test:/etc/apache2$ grep -C 1 httpd.conf apache2.conf 
# Include all the user configurations:
Include /etc/apache2/httpd.conf

User configurations it is...


Solution 4:

The Apache Software Foundation publishes many bits of software, one of which is a web server named httpd. The httpd project sources include among other things an httpd.conf sample configuration file, which is installed by default in /usr/local/etc/httpd or /etc/httpd. You will find httpd named as such on most systems.

However, long ago and far away, someone in the Debian GNU/Linux distribution decided to change the name of the software within that distribution from httpd to apache2. Thus on a Debian system you will find a configuration file named apache2.conf in a directory named /etc/apache2. I don't know who did this or why, but it's a perennial source of confusion on par with calling Windows "Microsoft" or ESXi "VMware". Distributions based on Debian, such as Ubuntu, inherit this strangeness. Even stranger, they then include a file /etc/apache2/httpd.conf which is Included from apache2.conf into which users can place custom configuration.

So the answer is, if you're on a Debian-based system, you bend your brain into doing things the way Debian wants you to do it. Otherwise you generally do things the normal way as the upstream httpd project does it.