在apache中运行perl脚本时出现403错误 [英] 403 Error when running perl script in apache
问题描述
我正在尝试通过本地主机测试perl脚本.我将apache配置为允许从/usr/lib/cgi-bin运行perl脚本(或者我认为是这样).每当我转到localhost/cgi-bin/script.pl时,都会收到403 Forbidden错误.这是我的apache conf文件.
I am trying to test perl scripts through localhost. I configured apache to allow perl scripts to be run from /usr/lib/cgi-bin (or so I thought). Whenever I go to localhost/cgi-bin/script.pl I get a 403 Forbidden error. Here is my apache conf file.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
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
在我的错误日志中,我不断得到这个信息:
In my error log I keep getting this:
[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
推荐答案
您有 Order allow,deny
,如果没有通过至少一个Allow指令,它将拒绝请求
You have Order allow,deny
, which will reject the request unless at least one Allow directive passes.
您没有Allow指令(目录/home/cgtopher/public_html/除外,该目录不包含cgi-bin目录).
You have no Allow directive (except for Directory /home/cgtopher/public_html/, which does not cover the cgi-bin directory).
(是否从所有代码中添加 Allow
到cgi-bin目录中?)
(Add Allow from all
to the cgi-bin directory?)
这篇关于在apache中运行perl脚本时出现403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!