日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

apache配置-html碎片shtml格式

發(fā)布時(shí)間:2023/12/2 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 apache配置-html碎片shtml格式 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

修改SSI 文件

conf–httpd.conf

<Directory "D:/Android/Apache2.2/htdocs"> ?//修改文件目錄

? ? #

? ? # Possible values for the Options directive are "None", "All",

? ? # or any combination of:

? ? # ? Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

? ? #

? ? # Note that "MultiViews" must be named *explicitly* — "Options All"

? ? # doesn't give it to you.

? ? #

? ? # The Options directive is both complicated and important. ?Please see

? ? # http://httpd.apache.org/docs/2.2/mod/core.html#options

? ? # for more information.

? ? #

? ? Options Indexes FollowSymLinks?Includes //添加include

? ? #

? ? # AllowOverride controls what directives may be placed in .htaccess files.

? ? # It can be "All", "None", or any combination of the keywords:

? ? # ? Options FileInfo AuthConfig Limit

? ? #

? ? AllowOverride None

? ??AddType text/html .shtml ?

? ? AddOutputFilter INCLUDES .shtml?//添加include

? ? #

? ? # Controls who can get stuff from this server.

? ? #

? ? Order allow,deny

? ? Allow from all

</Directory>

<IfModule dir_module>

? ?DirectoryIndex index.html index.shtml ?//這個(gè)是添加默認(rèn)的索引文件

</IfModule>

<Directory "D:/htdocs/test"> ?//修改文件目錄

? ? AllowOverride None

? ? Options None

? ? Order allow,deny

? ? Allow from all

</Directory>

詳解:

如何使你的Apache服務(wù)器支持SSI?

Apache(如何在windows以及l(fā)inuc下安裝apache請(qǐng)參見(jiàn)另兩篇文章)默認(rèn)是不支持SSI的,需要我們更改httpd.conf來(lái)進(jìn)行配置。我這里以windows平臺(tái)的Apache 2.0.x為例(在linux平臺(tái)下與之相同),打開(kāi)conf目錄下的httpd.conf文件,搜索“AddType text/html .shtml”,找到:

以下是引用片段:
# AddType text/html .shtml?
# AddOutputFilter INCLUDES .shtml

把這兩行前面的#去掉 。

然后搜索“Options Indexes FollowSymLinks”

在搜索到的那一行后面添加“ Includes”

即將該行改變?yōu)?Options Indexes FollowSymLinks Includes

熟悉apache manual的可能會(huì)覺(jué)得比較容易。

保存httpd.conf,重起apache即可

到此我們就完成了對(duì)Apache SSI的設(shè)置。

cmd命令檢查配置文件:

httpd.exe -t

?

總結(jié)如下:

方法1–apache配置:


1. 確認(rèn)加載include.so模塊,將注釋去掉:?
LoadModule include_module libexec/apache2/mod_include.so?


2. AddType部分去掉這兩段注釋:?
AddType text/html .shtml?
AddOutputFilter INCLUDES .shtml?


3. Directory目錄權(quán)限里面找到?
Options Indexes FollowSymLinks?
增加Includes修改為:?
Options Indexes FollowSymLinks Includes?


4. 重新啟動(dòng)Apache,測(cè)試:?
<!–#include file=”head.html”–>?
Holle Word!,這是中間的內(nèi)容?
<!–#include file=”foot.html”–>

?

方法2–.創(chuàng)建文件.htaccess

如果用戶不能直接訪問(wèn)服務(wù)器配置文件,可以使用文件編輯器創(chuàng)建一個(gè)名為.htaccess的文件。注意,文件名前一定要有符號(hào)“.”,這樣服務(wù)器才能知道該文件是隱藏文件,從而提高文件的安全性,避免錯(cuò)誤操作。在.htaccess文件中需要加入以下三行文字:
Options Indexes FollowSymLinks Includes?
AddType application/x-httpd-CGI .CGI?
AddType text/x-server-parsed-html .shtml
完成之后可以把.htaccess文件上傳到服務(wù)端的相應(yīng)目錄,該文件對(duì)所有子目錄有效。如果用戶希望在目錄級(jí)上禁止CGI或shell命令,可以在.htaccess文件中的Options選項(xiàng)行加入關(guān)鍵字IncludesNOEXEC

?

在頁(yè)面中引入shtml代碼:

<!--#include virtual="inc/head.shtml"-->
<!--#include virtual="inc/footer.shtml"-->

?

如果需要使用html解析包含,??

AddType application/x-httpd-CGI .CGI?
AddType text/x-server-parsed-html .shtml在 它后面添加


添加 AddOutputFilter INCLUDES .html 到下面即可


更多專業(yè)前端知識(shí),請(qǐng)上 【猿2048】www.mk2048.com

總結(jié)

以上是生活随笔為你收集整理的apache配置-html碎片shtml格式的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。