-
【求助】Apache VirtualHost問題
在VirtualHost堻]定如下:
NameVirtualHost 192.168.1.6
<VirtualHost 192.168.1.6>
ServerAdmin [email][email protected][/email]
DocumentRoot /home/123
ServerName [url]www.123.com[/url]
ScriptAlias /cgi-bin/ /home/123/cgi-bin/
ErrorLog logs/www.123-error_log
CustomLog logs/www.123.com-access_log common
</VirtualHost>
我的想在httpd.conf只堻]定VirtualHost來跑自己網站及CGI,而不想更改原本的設定,但是在跑CGI時老是出錯。
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: perl.cgi
If you think this is a server error, please contact the webmaster
Error 500
Apache/2.0.40 (Red Hat Linux)
我試過把cgi-bin堛構gi檔更換755,777,644等屬性都是出錯,請問是甚麼原因
-
Premature end of script headers: perl.cgi --> 看到這行了嗎
也許妳的程式寫錯了..:)
-
但我試過上傳別的CGI程式都是一樣出錯。
都搞不清楚到底是哪有問題。
-
我記的apache安裝起來
會有兩支 cgi 可以提供測試
一支是printenv
另外一支是test-cgi
也許你可以先從這兩支程式先去試試看能不能 run
-
這是我的httpd.conf,更改過不同的設定都是不行
請大大幫我看看是哪有問題
[url]http://scorpius.spaceports.com/~kwzone/httpd.conf[/url]
-
你的設定看起來是應該沒有問題的
問題可能是出在你的程式
-
設定檔有問題~以下以您的設定檔提出幾項
1.該有點的沒點
您的 AddHandler cgi-script cgi pl 請改為 AddHandler cgi-script .cgi .pl
2.CGI執行環境為 /cgi-bin/ /var/www/cgi-bin
您的CGI程式若不是放在這的話,是無法跑網頁CGI程式的
3.要使用 VirtualHost 功能要有預設的 VirtualHost 設定也就是原網址網頁
使用者要額外使用的 VirtualHost 需另外加設 VirtualHost 設定使用
4.由於你的用途及使用上的說明不是很清楚無法幫您一一改正,所以請詳加註以下資料
原 DomainName 網頁及欲額外使用的 DomainName 網頁
原主網頁目錄及欲額外使用的個人網頁目錄
CGI 執行環境的權限及安全性考量,使用共用或各別使用CGI程式
-
謝謝repsol及ActionFire兩位大大的大力提點,連日來的不停修改設定終於搞好了,而我也總結到小小的經驗。
● 就是如果在 /var/www/cgi-bin/ 以外使用CGI就得要加上 [COLOR=blue]+ExecCGI[/COLOR],而非[COLOR=red]ExecCGI[/COLOR]
如在 /home/user/ 下使用CGI:
ScriptAlias /cgi-bin/ "home/user/cgi-bin/"
<Directory "/home/user/cgi-bin">
AllowOverride None
Options [COLOR=blue]+ExecCGI[/COLOR]
Order allow,deny
Allow from all
</Directory>
這設定在Apache2是必要的,至於1.3版本就未試過。
●另外就是我的大意,RedHat喌sFTP的ASIIC傳送模式默認是不打開的,所以使上傳到Unix堛慢GI是Dos模式而不是Unix所用的模式,以至CGI上傳後不能使用;所以要在vsftpd.conf內把asiic模式打開。