日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

shtml用include加載文件,apache開啟SSI,及shtml壓縮_負載集群教程

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

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

  什么是SSI?

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

  實現(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"-->

 

  配置文件很簡單。

  apache配置如下:

  修改如下幾處

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

 

  includes 為追加

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

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ǎng)絡搜集//所屬分類:負載集群教程/更新時間:2013-04-14
相關負載集群教程