错误信息是:
command not in docroot (/home/site1/cgi-bin/test.pl).这里我发现了这个:
suexec要求CGI脚本位于服务器的DocumentRoot (而不是VirtualHost 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中使用Perl脚本,但是如果我不能解决这个问题,我可以将所有脚本移到htdocs。
发布于 2013-09-30 16:21:39
suEXEC有自己的docroot,它完全独立于您在Apache中配置的任何内容。通过调用suEXEC的docroot,您可以看到什么是:
suexec -V你可能需要支持这一点。在我的例子中,docroot是/var/www。你必须把你的剧本放在那里。无法更改此保存,重新编译suEXEC。不要试图使用符号链接将脚本保留在/var/www之外(或配置suEXEC的任何内容)。
编辑:正如@insaner在注释中提到的,命令可能是suexec,或者正如我在至少一个服务器suexec2上看到的那样。suEXEC正是Apache文档所称的模块/特性。
发布于 2020-08-03 05:19:25
如果您使用的是/etc/apache2/suexec/www-data包,那么在/etc/apache2/suexec/www-data中有一个配置,它的前2行如下。
/var/www
public_html/cgi-bin你需要用你的设置来替换这些行。应该有两行。只给一行将通过错误。
我用了下面这样的东西,
home
cgi-bin发布于 2013-09-26 13:09:33
将DocumentRoot /home/site1/htdocs更改为DocumentRoot /home/site1/
https://stackoverflow.com/questions/19004550
复制相似问题