Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

thanks

share|improve this question
add comment

1 Answer 1

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. site.example.org) 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 your.dns.name # 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
        </Directory>

        # 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
</VirtualHost>

Then as root run the command a2ensite site.example.org (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
add comment

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.