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?

1 Answer 1


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.

  • 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? Aug 22, 2011 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, 2011 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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