shtml用include加載文件,apache開(kāi)啟SSI,及shtml壓縮_負(fù)載集群教程
使用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
- 介紹服務(wù)器安全熱點(diǎn)12項(xiàng)技術(shù)
- Web網(wǎng)關(guān)的安全和性能
- 避免危害DNS服務(wù)器安全部署的七宗罪
- web中緩存的使用方法
- 服務(wù)器管理最容易犯的十大錯(cuò)誤
- 自定義FTP 體驗(yàn)極速的下載快感
- RAID0、RAID1、RAID5磁盤(pán)陣列的區(qū)別
- 圖文詳解服務(wù)器返回的各狀態(tài)碼
- 利用OpenIPMI監(jiān)控服務(wù)器溫度
- DNS高級(jí)服務(wù)器選項(xiàng)
- apache防盜鏈的兩種實(shí)現(xiàn)方法
- 在多臺(tái)服務(wù)器上簡(jiǎn)單實(shí)現(xiàn)Redis的數(shù)據(jù)主從復(fù)制
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索shtml用include加載文件,apache開(kāi)啟SSI,及shtml壓縮
- 教程說(shuō)明:
負(fù)載集群教程-shtml用include加載文件,apache開(kāi)啟SSI,及shtml壓縮。