How can I run multiple web domains on my server?

Now, to run multiple domains on one web server, you need to create a so-called virtual host. When a browser calls your web server, the browser also transmits the exact domain name and based on this information, the web server then displays a directory set for this domain.

To provide this functionality, you must create a virtual host for the domain in the Apache configuration.

Under Debian GNU/Linux, these are managed in individual text files under /etc/apache2/sites-available/. Here you can see a VHost declaration for the named domain, "", this is representative for the domain you want to create and you have to replace it with your domain:

<VirtualHost *>

DocumentRoot /var/www/

<Directory />
Options FollowSymLinks
AllowOverride None

<Directory /var/www/>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ErrorLog /var/log/apache2/
LogLevel warn
CustomLog /var/log/apache2/ combined
ServerSignature On


Save this file under the name "". After that you can activate it with the following command:

# a2ensite

...and finally restart the web server with the following command:

# service restart apache2

You cannot comment on this entry