免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2597 | 回复: 1
打印 上一主题 下一主题

Nginx SSI 配置一例 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-09-15 13:00 |只看该作者 |倒序浏览
Nginx SSI 配置一例



from www.iaibi.com [此为AD]  转载请注明 bbs.linuxtone.org
nginx 配置只需要添加
ssi on;
复制代码html内容如下:
  1. <div id="top">

  2. •        <ul class="top_menu">

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

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

  5. •                </span>

  6. •                <li id="loginlink"><a href="/sso/login">登录</a> - <a href="/reg/index.html">注册</a> |</li>

  7. •        </ul>

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

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

  10. •        <div id="menu">

  11. •                <span class="news right">

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

  13. •                                <a href="#" target="_blank">这里是登陆的新闻提示区最多十七个字...</a>

  14. •                        </marquee>

  15. •                </span>

  16. •        </div>

  17. •        <!--# else -->

  18. •        <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>

  19. •        <!--# endif -->

  20. •</div>
复制代码
复制代码如果请求的是top.html 显示 :
这里是登陆的新闻提示区最多十七个字...

否则 显示 :
公告: 运营


经过我的测试呢 必须要用正则方式去匹配,Nginx配置说明如下:
  1. <!--# if expr="$name" -->

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

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

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

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

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

  7. •<!--# if expr="$name != /text/" -->
复制代码
复制代码top.html 一般是个全局包含,如希望某个目录下都是用这个规则 如rge 目录则使用:
  1. <!--# if expr="$REQUEST_URI = //reg/*/" -->
复制代码
复制代码即可

附带apache 的ssi文档
http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/ssi.html

论坛徽章:
0
2 [报告]
发表于 2011-09-16 11:02 |只看该作者
抄来的, ssi好东西, 学习了.
http://wiki.nginx.org/HttpSsiModule
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP