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
/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.confwhich is Included from
apache2.confinto 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.
/etc/apache2/httpd.confis empty in Ubuntu, because the Apache configuration resides in
“httpd.conf is for user options.” No it isn’t, it’s there for historic reasons.
Using Apache server, all user options should go into a new
/etc/apache2/conf.d/. This method should be “update-safe”, as
apache2.confmay get overwritten on the next server update.
/etc/apache2/apache2.conf, you will find the following line, which includes those files:
># Include generic snippets of statements
As of Apache 2.4+ the user configuration directory is
a2enconf FILENAME_WITHOUT_SUFFIXto enable the new configuration file or manually create a symlink in
/etc/apache2/conf-enabled/. Be aware that as of Apache 2.4 the configuration files must have the suffix