歡迎您光臨本站 註冊首頁

Nginx SSI 配置一例

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

Nginx SSI 配置一例

Nginx SSI 配置一例


from www.iaibi.com [此為AD]  轉載請註明 bbs.linuxtone.org
nginx 配置只需要添加
ssi on;
複製代碼html內容如下:<div id="top">

•        <ul class="top_menu">

•                <span id="logoutlink" class="hideh">

•                        <li><span id="realname"></span> - <a href="/sso/logout">[退出]</a> |</li>

•                </span>

•                <li id="loginlink"><a href="/sso/login">登錄</a> - <a href="/reg/index.html">註冊</a> |</li>

•        </ul>

•        <span class="logo"></span>

•        <!--# if expr="$REQUEST_URI = //top.html/" -->

•        <div id="menu">

•                <span class="news right">

•                        <marquee direction="left" behavior="scroll" scrollamount="2" scrolldelay="1" onmouseout="this.start()" onmouseover="this.stop()">

•                                <a href="#" target="_blank">這裡是登陸的新聞提示區最多十七個字...</a>

•                        </marquee>

•                </span>

•        </div>

•        <!--# else -->

•        <p class="de"><marquee direction="left" bgcolor="#95959e" onmouseout="this.start()" onmouseover="this.stop()" behavior="scroll" scrollamount="2" scrolldelay="1"><a href="#" target="_blank">公告: 運營</a></marquee></p>

•        <!--# endif -->

•</div>複製代碼如果請求的是top.html 顯示 :
這裡是登陸的新聞提示區最多十七個字...

否則 顯示 :
公告: 運營


經過我的測試呢 必須要用正則方式去匹配,Nginx配置說明如下:<!--# if expr="$name" -->

•</code> A string comparison: <code>

•<!--# if expr="$name = text" -->

•<!--# if expr="$name != text" -->

•</code> Or a regex match: <code>

•<!--# if expr="$name = /text/" -->

•<!--# if expr="$name != /text/" --> 複製代碼top.html 一般是個全局包含,如希望某個目錄下都是用這個規則 如rge 目錄則使用:<!--# if expr="$REQUEST_URI = //reg/*/" -->複製代碼即可

附帶apache 的ssi文檔
http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/ssi.html
《解決方案》

抄來的, ssi好東西, 學習了.
http://wiki.nginx.org/HttpSsiModule

[火星人 ] Nginx SSI 配置一例已經有574次圍觀

http://coctec.com/docs/service/show-post-1942.html