星期五, 8月 19, 2005

Apache in Debian - 或許應該用Apache2

用Apt-get install apache 安裝
但是程式不叫httpd,而是叫apache。
configuration folder在/etc/apache
#/etc/init.d/apache start
#/etc/init.d/apache stop
config檔還是叫httpd.conf,在/etc/apache。

httpd.conf 內容:

Site root :
DocumentRoot /var/www
網站的根目錄在 /var/www

CGI 目錄:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
網站以/cgi-bin為path,會進入/usr/lib/cgi-bin/中,apache會認為這個folder理的page都是program.


上面install的是apache 1.0,目前應該要用apache 2.0 (Debian的default 安裝是2.0),手動安裝要用
#apt-get install apache2
設定檔在/etc/apache2 目錄中,設定檔和1.0已經有不同。folder中的README有說明

原來的http.conf已經不用了(其實是included by apache2.conf),apache2.conf已經變成主要的configuration檔。

原來httpd.conf的內容依照功能分成許多部分,由apache2.conf include進來。
ports.conf :
Listen 10.3.5.253:80
決定listen的address和port

sites-enabled/[^.#]*
應該是 支援virtual host衍生的目錄,決定site Document Root


奇怪,ssi還是起不來,已經在apache2.conf中加了
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
還有在 site-enabled/000-default中加了
Options +includes
可是還是不會動


找到原因了,是include module沒有load的關係。
在/etc/apache2/的mods-enables有一些link,都是link到mods-available。
在apache2.conf中有
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

其中並沒有include.load的link,所以要建一個link
#ln /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled/include.load
之後再reload apache2
#/etc/init.d/apache2 reload
其實apache2.conf已經將shtml的option加入了,所以不用修改。(不用加AddType ***** )


測試的網頁內容是:

<html>
<head> My first SSI page </head>
<body>
Welcome! Today is <!--#echo var="date_local"-->
</body>
</html>

沒有留言:

網誌存檔