1

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

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName domain.example
    ServerAlias www.domain.example

    DocumentRoot /var/www/domain.example/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>
1
  • 3
    Try making your Directory directive match your document root. <Directory /var/www/domain.com/public_html/> instead of <Directory /var/www/> Apr 9, 2014 at 12:22

1 Answer 1

1

Try this:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName domain.example
    ServerAlias www.domain.exaple

    DocumentRoot /var/www/domain.example/public_html
    <Directory /var/www/domain.example/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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.