Nginx学习记录

本人刚刚接触Nginx,对这个强大的服务器还没有充分的了解,现在在这里对我在使用Nginx的过程中碰到的一些问题做些总结!

1、ssi配置问题

这里我贴上我的nginx.conf配置文件中server模块的部分源码

server {
        listen       90;
        server_name  tly.web.com.cn;

        root   html;
        index  index.html index.htm;
            
        access_log  logs/webphl_access.log  tpynormal;
    
        ssi on;
        location ~ ^(/|/index.html|index.htm)$ {
            root   html;
            index  index.html index.htm;                
        }

在页面内容发送到客户端之前,使用SSI指令将文本、图片或代码信息包含到网页中。对于在多个文件中重复出现内容,使用SSI是一种简便的方法,将内容存入一个包含文件中即可,不必将其输入所有文件。通过一个非常简单的语句即可调用包含文件,此语句指示 Web 服务器将内容插入适当网页。而且,使用包含文件时,对内容的所有更改只需在一个地方就能完成。

这里贴上我的JSP页面中一段引发该页面先显示正常,然后1秒后闪跳到其他页面的问题,其实这个问题很简单,就是一个404或者500的错误而已

<!--ssi接口引入 -->
<!--#include virtual='/ssi/seo_hot.html'-->

我在jsp页面的文段引入了上面的代码,对于ssi来说,如果ssi开启的话,会去解析这个接口,如果没有开启,jsp会将其解析为注释

我在web.xml中配置错误的跳转页面如下

<error-page>
        <error-code>404</error-code>
        <location>/errors/error.jsp</location>
</error-page>

<error-page>
        <error-code>500</error-code>
        <location>/errors/error.jsp</location>
</error-page>

现在因为"/ssi/seo_hot.html"页面在系统中找不到,所以程序会跳到error.jsp页面中来,我的error.jsp页面如下

<%@page isErrorPage="true" %>
<meta http-equiv=refresh content='0; url=http://photo.tly.com.cn/'> 

综上所述,造成8月21号的错误就是因为/ssi/seo_hot.html页面没找到

 

posted @ 2013-08-21 15:38  ^_TONY_^  阅读(639)  评论(0编辑  收藏  举报