Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed an Apache2 server on a Linux Box (Ubuntu 10.04 TLS) and am trying to setup some virtual host and proxies. There is some stuff in the apache2.conf, an empty httpd.conf (which was used heavily in the Windows setup I had), and then there are the invidividual files for the websites in my sites-available directory, call them a.com and b.com.

What information needs to be where?
What is the priority of processing for these?
Will repeated information cause a problem?

share|improve this question
up vote 3 down vote accepted

Apache configuration is exhaustively covered in the Apache documentation (though, if you're using Debian or Ubuntu, there are some additional considerations) and the best way to familiarize with Apache will be to study each portion of the documentation as you encounter a need to use a particular module or set of directives.

To address your specific questions:

What information needs to be where?

The file system you described would suggest that your configuration is intended for name-based virtual hosts (the default Ubuntu 10.04 Apache configuration) so any directives which apply to your Apache configuration for all virtual hosts (i.e. domains, subdomains) should be added to httpd.conf and any directives specific to a given virtual host (including its declaration) should be added to the /sites-available/domain.com.conf (or similar) file.

What is the priority of processing for these?

Toward the end of a typical apache2.conf file, the following directive appears:

Include /etc/apache2/sites-enabled

This directive instructs Apache to include all configuration files in the sites-enabled directory. (see Include documentation)

Files are included in numeric then alphabetical order from 0-9 then A-z.

Will repeated information cause a problem?

Duplicate virtual host definitions will be ignored when Apache is started, however, you will receive a warning when this happens - ideally, you should run apache2ctl configtest (documentation) before attempting to restart Apache so you have the opportunity to correct duplicates or errors which would prevent Apache from starting.

Note that the config syntax checker will not warn you if there are file permission problems or other issues which would prevent Apache from starting.

share|improve this answer
Thanks, I don't think it's as exhaustive as it needs to be but you've helped answer most of what I needed to know. So on a Linux system is httpd.conf ever used? – Lance Roberts Aug 22 '11 at 4:03
@Lance Roberts - Yes, httpd.conf is the default config file for Apache 1.x installations and the Ubuntu Apache documentation recommends putting global config directives there. I'll amend my answer to point to some Debian/Ubuntu-specific resources too - you're right that the Debian/Ubuntu nuances aren't documented at Apache.org – danlefree Aug 22 '11 at 23:03

Your Answer


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.