Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

Your Answer

 
discard

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["                    <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2016.5.5.3547\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Webmasters Stack Exchange works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\r\n    </noscrip"], "copyright__copyright__copyright": ["empting to restart Apache so you have the opportunity to correct duplicates or errors which would prevent Apache from starting.\n\nNote that the config syntax checker will not warn you if there are file permission problems or other issues which would prevent Apache from starting.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}