which one of these two files should I use to configure Apache?

The httpd.conf is empty, while apache2.conf is not.

It confuses me!


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.

| improve this answer | |
  • 5
    I don't have a file called apapche2.conf – Doug Molineux Sep 9 '11 at 16:05

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.

| improve this answer | |
  • 1
    this is the correct answer ! and also the ports/mods-available config files if you want to elaborate on your answer – Sudhi Nov 19 '11 at 21:01

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... :)


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...

| improve this answer | |
  • 7
    +1 "httpd.conf is deprecated" – feeela Jul 27 '12 at 12:05

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.

| improve this answer | |

Apache 2.4

Do use:

Place any custom configurations in /etc/apache2/conf-available/{name}.conf

Enable/Disable your config using sudo a2enconf {name}or sudo a2disconf {name}.

(Then restart apache2 service.)

Don't use:

httpd.conf is deprecated and you should NOT see it anymore - if you do, leave it empty as installed.

apache2.conf is still installed, but leave it alone if you wish to upgrade Apache cleanly/easily.


Anything you might see in a 'global' Apache config can be added/overridden under your custom config as per above.

More: https://stackoverflow.com/a/11687212/503621

| improve this answer | |

If apache2.conf is not empty, and httpd.conf is empty, you should probably use apache2.conf ;-)

But I suppose that one includes the other (and that one of those is kept purely for backward compatibility reasons) -- so, it shouldn't change much.

Still, if you want to add something, like a new VirtualHost : is there not another sub-directory, in which you could put your file, and have it included ?

It would probably be a better solution : you would not modify the default file -- which would simplify updates.

| improve this answer | |

just open apache2.conf and look at the content:

Include /etc/apache2/mod-enabled/*.conf
Include /etc/apache2/httpd.conf

So if you want to include your own configuration add it to httpd.conf and apache2.conf will automatically get it.

As other say, apache2.conf can machine generated and it's better not to touch it.

For more information, generally Ubuntu uses apache2.conf and Centos uses httpd.conf. So all these files depends on which OS you have.

| improve this answer | |

To find the name and the location of the configuration file, you would have to:

1) Search as the process is called, in this case working with the apache user:

ps -ef | grep apache

(in this example, returns: httpd)

2) Show the variables used by the binary:

httpd -V | grep 'HTTPD_ROOT' && httpd -V | grep 'SERVER_CONFIG_FILE'

Extracted and screenshots at: http://www.sysadmit.com/2016/12/linux-apache-donde-esta-httpdconf-apache2conf.html

| improve this answer | |
  • Hello, It appears to me, that you have answered an already answered question, one that has been answered years ago. In addition, your solution is not helping the original questioner to resolve the issue, which configuration file is best practice to use. – M. Glatki Dec 27 '16 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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