在 apache 中 运行 perl 脚本时出现 403 错误
403 Error when running perl script in apache
我正在尝试通过本地主机测试 perl 脚本。我将 apache 配置为允许 perl 脚本从 /usr/lib/cgi-bin 变为 运行(或者我认为如此)。每当我去 localhost/cgi-bin/script.pl 时,我都会收到 403 Forbidden 错误。这是我的 apache 配置文件。
<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 指令通过。
您没有允许指令(目录 /home/cgtopher/public_html/ 除外,它不包含 cgi-bin 目录)。
(添加Allow from all
到cgi-bin目录?)
我正在尝试通过本地主机测试 perl 脚本。我将 apache 配置为允许 perl 脚本从 /usr/lib/cgi-bin 变为 运行(或者我认为如此)。每当我去 localhost/cgi-bin/script.pl 时,我都会收到 403 Forbidden 错误。这是我的 apache 配置文件。
<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 指令通过。
您没有允许指令(目录 /home/cgtopher/public_html/ 除外,它不包含 cgi-bin 目录)。
(添加Allow from all
到cgi-bin目录?)