Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do fix apache error "not within configured docroot" under Ubuntu

Greetings experts and gurus, I am looking for some help with an apache php configuration problem.

I have been running several websites from an apache2 setup on an ubuntu server for some time now without problems using the line NameVirtualHost * in my etc/apache2/conf.d/virtual.conf file. I recently updated the server version to the latest lts version and I am now unable to run php files.

I am running all my sites for the location "/home/www/[site-name]/htdocs" and I have setup and enabled all my sites in /etc/apache2/sites-available. I have also disabled the default site.

for each sites file I have specified the following:

    # Indexes + Directory Root.
    # DirectoryIndex index.html index.htm index.php
    DocumentRoot /home/www/[site-name]/htdocs/

    # CGI Directory
    ScriptAlias /cgi-bin/ /home/www/[site-name]/cgi-bin/
    <Location /cgi-bin>
            Options +ExecCGI
    </Location>

    # Logfiles
    ErrorLog  /home/www/[site-name]/logs/error.log
    CustomLog /home/www/[site-name]/logs/access.log combined

I restart apache and enter the url for a php test page on my server and I am met with an "Internal Server Error". When I check the error log I get:

Script "/home/www/[site-name]/htdocs/test.php" resolving to "/home/www/[site-name]/htdocs/test.php" not within configured docroot.

like image 573
Finglish Avatar asked Dec 06 '22 18:12

Finglish


1 Answers

For some reason when looking into the error, suphp came up a lot. According to this link:

Don't be fooled into thiking this has anything to do with the Apche virtual host document root, this is actually another setting in the suphp config file. Including the paths which contained the RoundCube scripts fixed this one. For example: docroot=/var/www:/usr/share/roundcube:/var/lib/roundcube:${HOME}/public_html

You need to edit your /etc/suphp/suphp.conf file and change the docroot to whatever is appropriate.

like image 75
Mike Avatar answered Dec 09 '22 06:12

Mike