- 论坛徽章:
- 0
|
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 |
|