Server Fault is a question and answer site for system and network administrators. 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'm trying to add a new domain to my server which is running debian and apache2. How exactly should i go about adding the domain? Through the sites-enabled/available? and if so how do i do it


share|improve this question
up vote 3 down vote accepted

In Debian virtual hosts are enabled by default, so after you have configured your dns drop a file named as you like (e.g. in /etc/apache2/sites-available with this content

# This tell apache to enable this vhost for all ports
<VirtualHost *>
        # These two are the only mandatory params for a vhost
        ServerName # dns name for this vhost
        DocumentRoot /your/document/root # document root for this vhost

        # Optional, allow override in .htaccess files
        <Directory /your/document/root>
                Options FollowSymLinks
                AllowOverride All

        # optional, log accesses and errors to a different file
        ErrorLog /var/log/apache2/your-name-error.log
        CustomLog /var/log/apache2/your-name-access.log combined

Then as root run the command a2ensite (the file name) and reload apache with /etc/init.d/apache2 reload as suggested by previous command. That's it.

If something goes wrong review your config with apache2ctl -t for syntax check and with apache2ctl -s for virtual host configuration.

share|improve this answer

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.