欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到夢飛科技

服務器租用

當前優惠活動:

Nginx + Tomcat 情況中關于SSI 的問題

在事情中利用到SSI,對付靜態頁面由Nginx處理懲罰SSI是沒有問題。對付jsp 文件內里的SSI怎么辦呢?我們不想開啟Tomcat的 SSI成果,我們但愿SSI 的理會交給Nginx來完成,,Tomcat 只處理懲罰應用。

下面的文章用實例說明這是可行的。

文章節選擇 《Netkiller Web 手札》 Tomcat 篇

3.2.6.5. Proxy 與 SSI

配景:nginx + tomcat 模式,nginx 開啟 SSI , Tomcat 動態頁面中輸出 SSI 標簽

         # cat  /etc/nginx/conf.d/www.netkiller.cn.conf
server {
    listen       80;
    server_name  www.netkiller.cn;
    charset utf-8;
    access_log  /var/log/nginx/www.netkiller.cn.access.log;
    location / {
        #index  index.html index.htm;
                proxy_pass http://127.0.0.1:8080;
        proxy_set_header    Host    $host;
        proxy_set_header    X-Real-IP   $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

test.jsp 文件

            <%@ page language="java" import="java.util.*,java.text.SimpleDateFormat" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
        <head>
        <title>show time</title>
</head>
<body>
<%
        Date date=new Date();
    SimpleDateFormat ss=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String lgtime=ss.format(date);
%>
        <center>
        <h1><%=lgtime%></h1>
        </center>
        <!--# set var="test" value="Hello netkiller!" -->
        <!--# echo var="test" -->
</body>
</html>

測試并查察源碼,你會看到SSI標簽

        <!--# set var="test" value="Hello netkiller!" -->
        <!--# echo var="test" -->

辦理方案

    location / {
        ssi on;
        proxy_set_header Accept-Encoding "";
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header    Host    $host;
        proxy_set_header    X-Real-IP   $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    }

再次測試,你將看不到SSI標簽,只能看到文本輸出Hello netkiller!

Netkiller(netkiller-ebook)

夢飛科技 - 全球數據中心基礎服務領先供應商

Copyright © 2003-2019 MFISP.COM. 國外服務器租用 IDC公司 版權所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 肇东市| 淳安县| 麦盖提县| 长丰县| 景德镇市| 郴州市| 阿拉尔市| 台中县| 五常市| 体育| 彭阳县| 合江县| 垦利县| 循化| 绥芬河市| 沙田区| 镇平县| 玛多县| 阜平县| 沈丘县| 青河县| 阳信县| 湖口县| 屏南县| 纳雍县| 镇安县| 天气| 忻州市| 金山区| 镇江市| 青岛市| 阿巴嘎旗| 桐乡市| 牡丹江市| 乌兰浩特市| 西乌| 色达县| 清徐县| 广东省| 长阳| 夏邑县|