欧美日韩精品在线,国内精品久久久久久久久,一级毛片恃级毛片直播,清纯唯美亚洲综合欧美色

shtml用include加載文件,apache開(kāi)啟SSI,及shtml壓縮_負(fù)載集群教程

編輯Tag賺U幣
什么是shtml呢?

    使用SSI(Server Side Include)的html文件擴(kuò)展名,SSI(Server Side Include),通常稱(chēng)為"服務(wù)器端嵌入"或者叫"服務(wù)器端包含",是一種類(lèi)似于ASP的基于服務(wù)器的網(wǎng)頁(yè)制作技術(shù)。默認(rèn)擴(kuò)展名是 .stm、.shtm 和 .shtml。

  什么是SSI?

  SSI是英文Server Side Includes的縮寫(xiě),翻譯成中文就是服務(wù)器端包含的意思。從技術(shù)角度上說(shuō),SSI就是在HTML文件中,可以通過(guò)注釋行調(diào)用的命令或指針。SSI具有 強(qiáng)大的功能,只要使用一條簡(jiǎn)單的SSI命令就可以實(shí)現(xiàn)整個(gè)網(wǎng)站的內(nèi)容更新,時(shí)間和日期的動(dòng)態(tài)顯示,以及執(zhí)行shell和CGI腳本程序等復(fù)雜的功能。 網(wǎng)站維護(hù)常常碰到的一個(gè)問(wèn)題是,網(wǎng)站的結(jié)構(gòu)已經(jīng)固定,卻為了更新一點(diǎn)內(nèi)容而不得不重做一大批網(wǎng)頁(yè)。SSI提供了一種簡(jiǎn)單、有效的方法來(lái)解決這一問(wèn)題,它將 一個(gè)網(wǎng)站的基本結(jié)構(gòu)放在幾個(gè)簡(jiǎn)單的HTML文件中(模板),以后我們要做的只是將文本傳到服務(wù)器,讓程序按照模板自動(dòng)生成網(wǎng)頁(yè),從而使管理大型網(wǎng)站變得容易。

  實(shí)現(xiàn)方法

  建立頭文件

  head.html

1
2
3
4
5
6
7
8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body>
<div style="background-color:#00CC66;boder:1px groove orange ">這是頭</div>

 

  foot.html

  這是尾

  </body></html>

  連接頭和尾

  linuxtone.shtml

1
2
3
4
5
<!--#include file="head.html"-->
<hr>
<b>頭尾文件內(nèi)容都顯示。表示SSI工作正常。shtml顯示正常</b>
<hr>
<!--#include file="foot.html"-->

 

  配置文件很簡(jiǎn)單。

  apache配置如下:

  修改如下幾處

1
2
3
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options Indexes FollowSymLinks includes

 

  includes 為追加

  你要是感覺(jué)麻煩可以用以下命令替換。

1
2
3
sed -i 's##AddType text/html .shtml#AddType text/html .shtml#' /usr/local/apachefile/httpd.conf
sed -i 's##AddOutputFilter INCLUDES .shtml#AddOutputFilter INCLUDES .shtml#'    /usr/local/apachefile/httpd.conf
sed -i 's#Options Indexes FollowSymLinks#Options Indexes FollowSymLinks includes #'    /usr/local/apachefile/httpd.conf

 

  shtml 的壓縮方法不同于js css php

  方法如下:

  AddOutputFilter INCLUDES;DEFLATE shtml 

來(lái)源:網(wǎng)絡(luò)搜集//所屬分類(lèi):負(fù)載集群教程/更新時(shí)間:2013-04-14
相關(guān)負(fù)載集群教程