Apache 2.4.29(Fedora)
Perl v5.26.1

我有一个网站,由于几个原因,运行在用户"jaf"的public_html目录之外 . 设置Apache以在本目录树中以本地用户("jaf")运行cgi脚本 . 所以,例如“http://billyard.ca/~jaf/cgi-bin/simpletest.cgi " successfully executes as user " jaf " (rather than the default " apache”) . 到目前为止,我想要实现的目标是:

  • 让apache运行所有被“http://billyard.ca/cgi-bin/ " as if they were called by " http://billyard.ca/~jaf/cgi-bin/ " (i.e., omit the "~jaf / ") yet still operate within the "~jaf / public_html " directory as user " jaf " rather than " apache”调用的cgi . 我在apache配置中添加了以下内容:

< VirtualHost *:80 >
Servername billyard.ca
SuexecUserGroup jaf jaf
DocumentRoot "/home/jaf/public_html"
ScriptAlias / cgi-bin / / home / jaf / public_html / cgi-bin /
< / VirtualHost >

这工作"billyard.ca/~jaf/cgi-bin/simpletest.cgi" .
这失败"billyard.ca/cgi-bin/simpletest.cgi";它给了我500内部服务器错误和suexec报告"command not in docroot" .

  • 让selinux允许这个(现在我必须进入许可模式,否则我得到apache "premature end of header"错误消息)