Where should I place all the configurations for my web site on Apache?

I have a web site on the Apache HTTP Server that's installed on the Ubuntu Server. I create my own config file in the /etc/apache2/sites-enabled/mywiki.conf where I added the <VirtualHost>...</VirtualHost> where I place all the configurations.

In the official Apache documentation it is always said that you put your configs to the /etc/apache2/apache2.conf or sometimes to the /etc/apache2/sites-enabled/000-default.conf.

I'm a little bit confused about this. What is the proper place where I should put all the configurations for my web site?

Answers 1

  • See the tutorial How To Configure the Apache Web Server on an Ubuntu or Debian VPS.

    Briefly, the /etc/apache2 folder contains the config files and folders.

    For defining the websites, the official word is to use these folders (which you did):

    • sites-available/: This directory contains all of the virtual host files that define different web sites. These will establish which content gets served for which requests. These are available configurations, not active configurations.

    • sites-enabled/: This directory establishes which virtual host definitions are actually being used. Usually, this directory consists of symbolic links to files defined in the "sites-available" directory.

    Although, for your own small server where you're the only administrator, nothing obliges you to be a stickler to these conventions, or you could make your own. You do not have to follow the conventions adopted by other people on their setups, as long as everything works out to your satisfaction. Apache does not oblige you to use the above folder setup.

Related Questions