我正在尝试通过localhost测试perl脚本。我将apache配置为允许perl脚本从/usr/lib/cgi-bin(或者我想的那样)运行。每当我转到localhost/cgi bin/script.pl时,就会得到一个403禁止的错误。这是我的apache conf文件。
<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
在我的错误日志中,我一直得到:
[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指令通过。
您没有allow指令(directory/home/cgtopher/public_html/除外,它不包含cgi bin目录)。
(将Allow from all
添加到cgi-bin目录?)
关于linux - 在apache中运行perl脚本时出现403错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32416046/