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.

well I'm trying to add an additional domain to my server.

in etc/apache2/sites-available/ I have the file like this

# This tell apache to enable this vhost for all ports

ServerName  example.com
        ServerAlias www.example.com 
        DocumentRoot /var/www/example-com
    # Optional, allow override in .htaccess files
    <Directory /var/www/example-com>
            Options FollowSymLinks
            AllowOverride All
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/example-com/
    <Directory "/usr/lib/cgi-bin/example-com/">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

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

(I changed it to example.com from my domain)

and then I ran a2ensite, it said everything worked fine. I reloaded apache but still when I go to my domain it's just pointing to the regular default directory. Any ideas why it's not going to the directory I specified?

Thanks

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

There is no <VirtualHost *:80> section in your config. Isn't it a mistype? Place your configuration inside section this way:

<VirtualHost *:80>
    ServerName  example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example-com
    # Optional, allow override in .htaccess files
    <Directory /var/www/example-com>
            Options FollowSymLinks
            AllowOverride All
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/example-com/
    <Directory "/usr/lib/cgi-bin/example-com/">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    # optional, log accesses and errors to a different file
    ErrorLog /var/log/apache2/example-error.log
    CustomLog /var/log/apache2/example-access.log combined
</VirtualHost>

Then reload apache and see if the problem is fixed.

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.