Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have 3 domains hosted on my Ubuntu server running apache2 as DNS I am using cloudflare.com abc.com and xyz.com are accessing correct files that are inside abc.com/public_html and xyz.com/public_html folder but the third domain is accessing files from the root folder. Following is the content of my domain.com file which is found under /etc/apache2/sites-available/domain.com

<VirtualHost *:80>
    ServerAdmin webmaster@domain.com
    ServerName domain.com
    ServerAlias www.domain.com

    DocumentRoot /var/www/domain.com/public_html
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
share|improve this question
2  
Try making your Directory directive match your document root. <Directory /var/www/domain.com/public_html/> instead of <Directory /var/www/> –  Stephen Ostermiller Apr 9 at 12:22
add comment

1 Answer 1

Try this:

<VirtualHost *:80>
    ServerAdmin webmaster@domain.com
    ServerName domain.com
    ServerAlias www.domain.com

    DocumentRoot /var/www/domain.com/public_html
    <Directory /var/www/domain.com/public_html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

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

You had 2 Directory directives and either one pointed to your DocumentRoot.

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.