本文介绍了(13)权限被拒绝:访问被拒绝/cgi-bin/test.cgi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一次,但没有成功尝试CGI的脚本。我看过很多教程,并随后在不同的论坛可能的线程,但我不能使它工作。
我使用的是Fedora 10的机器上appache Web服务器。
我总是有问题

I am trying out CGI-scripts for the first time but without success. I have read many tutorials and followed may threads in different forums but I can not make it work.I am using a appache web server on a Fedora 10 machine.I always have problem with

[Wed Oct 21 20:47:36 2009] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Wed Oct 21 20:47:36 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Oct 21 20:47:36 2009] [notice] Digest: generating secret for digest authentication ...
[Wed Oct 21 20:47:36 2009] [notice] Digest: done
[Wed Oct 21 20:47:36 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.9 mod_ssl/2.2.11 OpenSSL/0.9.8g configured -- resuming normal operations

我需要帮助。
这是我的环境是什么样子。

I need help.This is what my environment looks like.

uname -a
Linux localhost.localdomain 2.6.27.5-117.fc10.i686 #1 SMP Tue Nov 18 12:19:59 EST 2008 i686 i686 i386 GNU/Linux

ls -l /var/www/cgi-bin/
total 36
-rwxrwxrwx 1 root root   106 2009-10-21 18:29 index.html
-rwxr-xr-x 1 root root 11089 2009-02-24 20:11 squidGuard.cgi
-rwxr-xr-x 1 root root  5720 2009-02-24 20:11 squidGuard-simple.cgi
-rwxr-xr-x 1 root root  5945 2009-02-24 20:11 squidGuard-simple-de.cgi
-rwxrwxrwx 1 root root   110 2009-10-21 17:38 test.cgi

apachectl -v
Server version: Apache/2.2.11 (Unix)
Server built:   Mar  6 2009 09:12:25

perl -version
This is perl, v5.10.0 built for i386-linux-thread-multi
Copyright 1987-2007, Larry Wall

我的剧本

cat test.cgi
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "Hello, world!\n";

该错误消息我根当我尝试访问网页服务器http://192.168.50.29/cgi-bin/test.cgi看起来是这样的:

The error message I gen when I try to access the web page server "http://192.168.50.29/cgi-bin/test.cgi" looks like this:

[Wed Oct 21 21:00:27 2009] [error] [client 192.168.50.69] (13)Permission denied: access to /cgi-bin/test.cgi denied

我已经添加了一行:

I have added the line:

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

要/etc/httpd/conf/httpd.conf中

to /etc/httpd/conf/httpd.conf

我不能使它工作。
谁能帮我?

I just can not make it work.Can anyone help me?

推荐答案

检查你的操作系统权限test.cgi,并确保您使用的是运行你的apache已经阅读权限的用户或组。

编辑 - 问题是与权限,但不具有读取权限,因为你正在使用SELinux的,你不用担心你的文件内容。勾选此,它解释了相当多的选项,以解决您的问题。

EDIT - The problem is with permissions, but not with read permissions, as you are using SELinux, you need to worry about your file context. Check this thread at fedora forums, it explains quite a few options to solve your problem.

这篇关于(13)权限被拒绝:访问被拒绝/cgi-bin/test.cgi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 11:44