在Apache、IIS和Nginx開(kāi)啟如何SSI?

2010-09-09 18:09:17來(lái)源:作者:

一些網(wǎng)站系統(tǒng)可能用到了SSI,下面就分別介紹在Apache和IIS開(kāi)啟如何SSI?

一些網(wǎng)站系統(tǒng)可能用到了SSI,下面就分別介紹在Apache和IIS開(kāi)啟如何SSI?

Apache(Linux / Windows 環(huán)境通用)


配置 httpd.conf(在 Apache 安裝目錄下的 conf/ 目錄下),看有沒(méi)有這兩行,沒(méi)有就加上:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

接下來(lái)到你的虛擬主機(jī)配置項(xiàng)里,配置如下的一行:

Options -Indexes FollowSymLinks Includes

這個(gè)看情況,自己比對(duì)一下,有沒(méi)有漏掉哪個(gè)單詞。

最后附一個(gè)虛擬主機(jī)的參考配置(提示:不要直接拷貝):

<VirtualHost *:80>
        ServerName cmstop.run
        DocumentRoot "D:\SERVER\www\cmstop.run"
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        <Directory />
                Options -Indexes FollowSymLinks MultiViews Includes
                DirectoryIndex index.shtml index.html index.php
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
        ServerSignature On
</VirtualHost>

Windows 2003 下的 IIS

windows 2003 安裝好 IIS 之后默認(rèn)是支持 .shtml 的,只要在 “WEB服務(wù)擴(kuò)展” 允許 “在服務(wù)器前端的包含文件” 即可,重啟 IIS 使配置生效。

Windows 2000 下的 IIS

打開(kāi) IIS,在要配置的網(wǎng)站上點(diǎn)擊右鍵,選擇屬性,并在接下來(lái)的窗口中點(diǎn)擊主目錄,再點(diǎn)擊右下方的配置,打開(kāi)應(yīng)用程序配置界面,如果列表中不存在 .shtml 和 .shtm,則需要自己手動(dòng)添加,點(diǎn)擊 添加 按鈕,在打開(kāi)的窗口中輸入:

可執(zhí)行文件:C:\WINDOWS\system32\inetsrv\ssinc.dll
擴(kuò)展名:.shtml或.shtm
限制為:GET,POST
勾選“腳本引擎”和“確認(rèn)文件是否存在”;

一路確定下去即可完成,之后重啟 IIS 使配置生效。

Nginx下開(kāi)啟SSI

這個(gè)最簡(jiǎn)單,在 nginx 的 http 配置節(jié)中,添加如下的一行即可:

http
{
    ...
    ssi on;
    ...
}

之后記得重啟 Nginx。

關(guān)鍵詞:SSIApacheIIS

贊助商鏈接: