2015-09-05 86 views
1

我想通过本地主机测试perl脚本。我配置了Apache以允许Perl脚本从/ usr/lib/cgi-bin运行(或者我认为)。每当我去localhost/cgi-bin/script.pl,我得到一个403 Forbidden错误。这是我的apache conf文件。403在Apache中运行perl脚本时出错

<VirtualHost *:80> 

ServerAdmin [email protected] 
DocumentRoot /home/cgtopher/public_html/ 

<Directory /home/cgtopher/public_html/> 
Options FollowSymLinks Indexes 
AllowOverride None 
Order allow,deny 
allow from all 
</Directory> 

<Directory /> 
Options FollowSymLinks 
AllowOverride None 
Order deny,allow 
Deny from all 
</Directory> 

#cgi-bin 

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 

<Directory "/usr/lib/cgi-bin"> 

AllowOverride None 

Options ExecCGI FollowSymLinks 

Order allow,deny 

Require all granted 

</Directory> 

ErrorLog /home/cgtopher/.apache/error.log 
CustomLog ${APACHE_LOG_DIR}/access.log combined 

在我的错误日志中我不断收到这样的:

[Sat Sep 05 10:30:12.565510 2015] [access_compat:error] [pid 10918] [client 127.0.0.1:60699] AH01797: client denied by server configuration: /usr/lib/cgi-bin/hello.pl 

回答

2

你有Order allow,deny,这将拒绝该请求,除非至少一个允许指令通过。

您没有Allow指令(Directory/home/cgtopher/public_html /除外,不包括cgi-bin目录)。

(将Allow from all添加到cgi-bin目录?)

+0

感谢您的支持!看起来它的工作,只有一个警告。而不是脚本运行(只是一个测试你好世界),我得到提示下载它。所以我们到了一半! – cgtopher

+0

这很奇怪。 ScriptAlias应该设置处理程序。你确定这是正在下载的脚本,而不是它的输出? –