第 1 頁 (共 1 頁)
CGI configuration on Apache
發表於 : 04/01/2003 1:36 am
由 luisehsu
sorry for this basic question:
1. the DocumentRoot is /var/www/html
2. below is my configuration relative cgi configuration in httpd.conf:
代碼: 選擇全部
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
AddHandler cgi-script cgi pl
<Directory /home/*/htdoc>
AllowOverride FileInfo AuthConfig
Options MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec +ExecCGI
Order allow,deny
Allow from all
</Directory>
3. when i try to run a test script (perl), which is located in /var/www/cgi-bin/ and /home/user_name/htdoc/, through web, i got 403(forbidden) and 500(internal error) message
4. however, if i relocate test-script in /var/www/perl, the script runs fine
5. system information:
Apache 1.3.26 on Mandrake Linux 9.0
besides, i found there are two conf file, httpd.conf and httpd-perl.conf which are almost identical, except the additional configuration i add in httpd.conf
thanks
Re: CGI configuration on Apache
發表於 : 04/01/2003 3:39 am
由 fddi1
Make sure your cgi script has the correct permission.
Re: CGI configuration on Apache
發表於 : 04/01/2003 5:04 am
由 luisehsu
fddi1 寫:Make sure your cgi script has the correct permission.
the owner of script is rootand permission is 755
i suppose this should be sufficient enough for cgi execution
thanks
Re: CGI configuration on Apache
發表於 : 04/01/2003 5:07 am
由 fddi1
luisehsu 寫:fddi1 寫:Make sure your cgi script has the correct permission.
the owner of script is rootand permission is 755
i suppose this should be sufficient enough for cgi execution
thanks
Give it a 777 for a test and see if it works.

Re: CGI configuration on Apache
發表於 : 04/01/2003 5:15 am
由 fddi1
fddi1 寫:luisehsu 寫:fddi1 寫:Make sure your cgi script has the correct permission.
the owner of script is rootand permission is 755
i suppose this should be sufficient enough for cgi execution
thanks
Give it a 777 for a test and see if it works.

BTW, make sure your cgi-bin directory has the right permission as well.
Re: CGI configuration on Apache
發表於 : 04/01/2003 6:06 am
由 luisehsu
fddi1 寫:fddi1 寫:
Give it a 777 for a test and see if it works.

BTW, make sure your cgi-bin directory has the right permission as well.
well
my cig-bin directory and test-script are totally opened now (set to 777)
and i still get the 403 forbidden error message
thanks
Re: CGI configuration on Apache
發表於 : 04/01/2003 6:20 am
由 fddi1
luisehsu 寫:fddi1 寫:fddi1 寫:
Give it a 777 for a test and see if it works.

BTW, make sure your cgi-bin directory has the right permission as well.
well
my cig-bin directory and test-script are totally opened now (set to 777)
and i still get the 403 forbidden error message
thanks
In that case, check both your access_log and error_log on your Apache server, and see what they say.
Re: CGI configuration on Apache
發表於 : 04/01/2003 6:50 am
由 luisehsu
fddi1 寫:
In that case, check both your access_log and error_log on your Apache server, and see what they say.
these are what i got from error_log:
代碼: 選擇全部
[Mon Mar 31 17:30:41 2003] [error] Premature end of script headers: /home/user_name/htdoc/test.cgi
[Mon Mar 31 17:31:19 2003] [error] client denied by server configuration: /var/www/cgi-bin/test.cgi
the former one is generated while accessing cgi in home directory, and later one by accessing cgi in /cgi-bin directory
the configuration of httpd.conf is still the same, and permission has changed to 777
thanks
Re: CGI configuration on Apache
發表於 : 04/01/2003 7:00 am
由 fddi1
luisehsu 寫:fddi1 寫:
In that case, check both your access_log and error_log on your Apache server, and see what they say.
these are what i got from error_log:
代碼: 選擇全部
[Mon Mar 31 17:30:41 2003] [error] Premature end of script headers: /home/user_name/htdoc/test.cgi
[Mon Mar 31 17:31:19 2003] [error] client denied by server configuration: /var/www/cgi-bin/test.cgi
the former one is generated while accessing cgi in home directory, and later one by accessing cgi in /cgi-bin directory
the configuration of httpd.conf is still the same, and permission has changed to 777
thanks
Do you have something like this in your httpd.conf?
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
Re: CGI configuration on Apache
發表於 : 04/01/2003 7:33 am
由 luisehsu
fddi1 寫:
Do you have something like this in your httpd.conf?
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
well
in httpd.conf, this is the global setup:
<Directory />
Options -All -Multiviews
AllowOverride None
Order deny,allow
Deny from all
</Directory>
and for cgi-bin dir:
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
AddHandler cgi-script .cgi
<Directory /var/www/cgi-bin>
AllowOverride All
Options ExecCGI
</Directory>
thanks
Re: CGI configuration on Apache
發表於 : 04/01/2003 7:33 am
由 digdog
你的 cgi 第一行是長這樣嗎?
代碼: 選擇全部
#!/usr/bin/perl -w
你裝了其他版本的 Perl 嗎?
Re: CGI configuration on Apache
發表於 : 04/01/2003 7:46 am
由 luisehsu
digdog 寫:你的 cgi 第一行是長這樣嗎?
代碼: 選擇全部
#!/usr/bin/perl -w
你裝了其他版本的 Perl 嗎?
yes
that's exactly the first line of my test script and the location of perl
my perl version:
This is perl, v5.8.0 built for i386-linux-thread-multi
thanks
Re: CGI configuration on Apache
發表於 : 04/01/2003 8:00 am
由 digdog
luisehsu 寫:
yes
that's exactly the first line of my test script and the location of perl
my perl version:
This is perl, v5.8.0 built for i386-linux-thread-multi
thanks
我猜啦,是你的 perl 出了問題。要不要先 % perl -V 看看?
Re: CGI configuration on Apache
發表於 : 04/01/2003 8:04 am
由 luisehsu
digdog 寫:
我猜啦,是你的 perl 出了問題。要不要先 % perl -V 看看?
shouldn't be
in httpd.conf there are 2 dir set for cgi script:
/var/www/cgi-bin
/var/www/perl
the same test.cgi has no problem while located in /perl, but error message while in /cgi-bin
thanks
Re: CGI configuration on Apache
發表於 : 04/02/2003 12:36 am
由 fddi1
In your globala setup, replace this section:
<Directory />
Options -All -Multiviews
AllowOverride None
Order deny,allow
Deny from all
</Directory>
with this section:
<Directory />
Options -All -Multiviews
AllowOverride None
Order deny,allow
Allow from all
</Directory>
Re: CGI configuration on Apache
發表於 : 04/03/2003 10:20 pm
由 luisehsu
謝謝各位的幫忙
終於搞定了
發現除了global directory setting的問題之外
suexec的setup也有問題
所以即使httpd.conf的設定都沒錯
cgi還是沒有辦法在指定的目錄下執行(ex. user's home dir)
apache的說明文件中指出suexec並非default installed
但是似乎mandrake並不這樣想
害我搞了半天
目前是按照apache的說明建議把suexec拿掉
文件中沒有說明how to configure suexec after compilation
還是只有重新configure and compile一途?
謝謝
Re: CGI configuration on Apache
發表於 : 04/03/2003 11:41 pm
由 digdog
luisehsu 寫:
文件中沒有說明how to configure suexec after compilation
還是只有重新configure and compile一途?
謝謝
說到 suEXEC,那就要請你看
這裡啦!(雖然是給 OS X 的,不過不無小補)
Re: CGI configuration on Apache
發表於 : 04/04/2003 1:04 am
由 luisehsu
digdog 寫:luisehsu 寫:
文件中沒有說明how to configure suexec after compilation
還是只有重新configure and compile一途?
謝謝
說到 suEXEC,那就要請你看
這裡啦!(雖然是給 OS X 的,不過不無小補)
糟糕
中文造詣太差
讓digdog以為我是用平假名(還是片假名?).....
日文不通啊!
