我第一次嘗試CGI腳本但沒有成功。我已閱讀了許多教程,並在不同的論壇中遵循了可能的線程,但我無法使其工作。 我在Fedora 10機器上使用appache web服務器。 我總是有問題(13)權限被拒絕:訪問/cgi-bin/test.cgi被拒絕
[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
我需要幫助。 這就是我的環境。
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」看起來是這樣的:
[Wed Oct 21 21:00:27 2009] [error] [client 192.168.50.69] (13)Permission denied: access to /cgi-bin/test.cgi denied
我已經添加了一行:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
到/etc/httpd/conf/httpd.conf
我只是不能讓它工作。 任何人都可以幫助我嗎?
該錯誤消息我創,當我嘗試訪問該網頁服務器「http://192.168.50.29/test。cgi「看起來像這樣: [Wed Oct 21 22:31:32 2009] [error] [client 192.168.50.69](13)Permission denied:exec of'/var/www/html/test.cgi'failed [Wed Oct 21 22:31:32 2009] [error] [client 192.168.50.69]腳本標題提前結束:test.cgi – 2009-10-21 11:19:44
爲什麼哦,爲什麼root擁有這些文件? – 2009-10-31 13:18:19
找出哪個用戶/組擁有apache服務器進程並確保它擁有你的CGI腳本並擁有exec權限 – heferav 2009-10-31 14:20:58