dqpkea9486 2011-11-21 07:06
浏览 25
已采纳

如何在Ubuntu下修复“不在配置的docroot中”的apache错误

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.

  • 写回答

3条回答 默认 最新

  • du0923 2011-11-21 07:44
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?