2013-09-25 29 views
5

错误消息:阿帕奇了suexec “命令不在文档根目录”

command not in docroot (/home/site1/cgi-bin/test.pl). 

Here我发现这一点:

suexec的需要CGI脚本是在服务器的DocumentRoot(而不是虚拟主机的DocumentRoot) 。但是,允许VirtualHost DocumentRoot成为出现在真实DocumentRoot下的目录的符号链接。

虚拟主机配置的一部分:

[...] 
DirectoryIndex index.html index.html index.php 
DocumentRoot /home/site1/htdocs 

SuexecUserGroup site1 site1 

ScriptAlias /cgi-bin/ /home/site1/cgi-bin/ 
<Location /home/site1/cgi-bin> 
      Options +ExecCGI 
</Location> 

<Directory /home/site1/> 
Options -Includes -Indexes -FollowSymLinks +ExecCGI MultiViews 
AddHandler cgi-script .cgi .pl 
AllowOverride none 
Order allow,deny 
Allow from all 
</Directory> 
[...] 

所以,我更喜欢有cgi-bin目录中的Perl脚本,但如果我解决不了这个问题,我可以将所有脚本htdocs目录。

回答

13

suEXEC都有自己的docroot它是完全独立无论你在你的Apache配置配置的。你可以看到suEXEC的文档根目录是通过调用:

suexec -V 

您可能需要以root身份为。在我的案例中,文档是/var/www。你必须把你的脚本放在那里。没有办法改变这个保存重新编译suEXEC。不要试图使用符号链接来保持你的脚本不在/var/www之外(或者你的suEXEC被配置为)。

编辑:正如@insaner在评论中提到的那样,该命令可能是suexec或者正如我在至少一个服务器上看到的suexec2suEXEC正是Apache文档所称的模块/功能。

+3

软件包'apache2-suexec-custom'允许更多的灵活性。 –

+0

优秀。正是我在找什么。 –

+0

该命令更可能是'suexec -V',请注意上限。 – insaner

-4

变化的DocumentRoot /home/site1/htdocs到的DocumentRoot /home/site1/