" />

亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

nginx整合tomcat

系統 2065 0

1、準備軟件(存放在目錄/home/sofeware下)

agentzh-headers-more-nginx-module-v0.15rc2-0-g2c629de.tar.gz ?#支持隱藏頭部信息 ?(不是必須,覺得需要就安裝吧)

nginx-upstream-jvm-route-0.1.tar.gz ? #nginx會話記錄的必須模塊 ? (用于tomcat集群,單tomcat就直接忽略相關操作)

pcre-8.10.tar.gz ? ?#包括? perl ?兼容的正規表達式庫 (shell> rpm -qa|grep pcre 可以檢查系統是否已存在 )

nginx-1.0.4.tar.gz

apache-tomcat-7.0.11.tar.gz ?(安裝相對簡單、資料也比較多,這里不演示了)

2、 編譯安裝

      
shell > cd / home / sofeware
shell
> tar zxf pcre - 8.10 .tar.gz && cd pcre - 8.10
shell
> . / configure && make && make install
shell>cd ..
shell
> tar zxf agentzh - headers - more - nginx - module - v0.15rc2 - 0 - g2c629de.tar.gz
shell
> tar zxf nginx - upstream - jvm - route - 0.1 .tar.gz
shell
> tar zxf nginx - 1.0 . 4 .tar.gz
shell
> cd nginx - 1.0 . 4
shell
> patch - p0 < /home/sofeware / nginx_upstream_jvm_route / jvm_route.patch
shell
> . / configure -- prefix =/ usr / local / nginx -- with - http_stub_status_module -- with - http_ssl_module
-- add - module =/ home / sofeware / nginx_upstream_jvm_route /
-- add - module =/ home / sofeware / agentzh - headers - more - nginx - module - 2c629de /
&& make && make install

3、配置 (默認80端口)

配置文件:/usr/local/nginx/conf/nginx.conf

      
// 運行nginx所在的用戶名和用戶組
user nginx nginx;
worker_processes
1 ;
// 全局錯誤日志及PID文件
error_log / usr / local / nginx / logs / error.log;
pid
/ usr / local / nginx / nginx.pid;
events {
worker_connections
1024 ;
}
http {
include mime.types;
default_type application
/ octet - stream;
// 全局訪問日志
access_log / usr / local / nginx / logs / access.log;
sendfile on;
keepalive_timeout
65 ;
server {
listen
80 ;
server_name localhost;
root / var / www / test; //網站根目錄
#charset koi8
- r;
access_log
/ usr / local / nginx / logs / host.access.log;
location
/ {
// 將index.jsp 加入到默認的訪問首頁地址
index index.html index.htm index.jsp;
}
// 所有jsp的頁面均交由tomcat處理
location ~ . * .jsp$ {
index index.jsp;
proxy_pass http:
// localhost:8080;
}
// 設定訪問靜態文件直接讀取不經過tomcat
location ~ . * \.(gif | jpg | jpeg | png | bmp | swf)$ {
expires 30d;
}
location
~ . * \.(js | css) ? $ {
expires 1h;
}
error_page
500 502 503 504 / 50x.html;
location
= / 50x.html {
root html;
}
}

4、測試配置

      
shell >/ usr / local / nginx / sbin / nginx - t
// 出現如下信息表示配置成功,否則檢查配置文件
the configuration file / usr / local / nginx / conf / nginx.conf syntax is ok  
the configuration file
/ usr / local / nginx / conf / nginx.conf was tested successfully

5、啟動、、重啟、停止

      
shell >/ usr / local / nginx / sbin / nginx // 啟動
shell>/user/local/nginx/sbin/nginx -s reload //重啟
shell > / usr / local / nginx / sbin / nginx - s stop // 停止

6、添加新模塊(非覆蓋安裝)

NginxHttpRealIpModule //有些網站使用這樣的方式來搭建分布式緩存,若干臺Squid放在前面提供緩存服務,內容從后面的 Nginx獲取。不過如此一來,Nginx日志里看到的IP就是Squid的IP了,為了能讓Nginx透明獲取IP,可以使用 NginxHttpRealIpModule

ngx_cache_purge-1.3.tar.gz ?//通過該模塊使得Nginx可以像squid使用PURGE指令手動清除指定URL的緩存頁面

      
shell >/ usr / local / nginx / sbin / nginx - s stop // 關閉nginx服務
shell > tar zxf ngx_cache_purge - 1.3 .tar.gz
shell
> cd ..
shell
> tar zxf nginx - 1.0 . 4 .tar.gz
shell
> cd nginx - 1.0 . 4
shell
> patch - p0 < / home / sofeware / nginx_upstream_jvm_route / jvm_route.patch
shell
> . / configure -- prefix =/ usr / local / nginx -- with - http_stub_status_module -- with - http_ssl_module
-- with - http_realip_module // 新增模塊
-- add - module =/ home / sofeware / nginx_upstream_jvm_route /
-- add - module =/ home / sofeware / agentzh - headers - more - nginx - module - 2c629de /
-- add - module =/ home / sofeware / ngx_cache_purge - 1.3 / // 新增模塊
shell > make // 編譯即可,無需make install
shell > mv / usr / local / nginx / sbin / nginx / usr / local / nginx / sbin / nginx.bak // 備份執行文件
shell > cp - r objs / nginx / usr / local / nginx / sbin /
shell
>/ usr / local / nginx / sbin / nginx - t // 測試是否通過
shell > rm - rf / usr / local / nginx / nginx.pid // 刪除PID,具體文件路徑按自己的配置的實際情況
shell >/ usr / local / nginx / sbin / nginx // 重啟
shell >/ usr / local / nginx / sbin / nginx - V // 查看編譯參數

nginx整合tomcat


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: a一级毛片免费播放 | 青青青手机版视频在线观看 | 国产日韩欧美在线观看免费视频 | 国产97色在线 | 免费 | 亚洲日日做天天做日日谢 | 一级毛片一级毛片a毛片欧美 | 九九99久久精品在免费线bt | 成 人 色综合 | 91视频网页版 | 久久666 | 日本久久精品免视看国产成人 | 国内精品伊人久久久久妇 | 久久久91精品国产一区二区三区 | 青草久草视频 | 四虎影院在线免费播放 | 免费精品久久久久久中文字幕 | 91久久福利国产成人精品 | 国产真实自拍 | 狠狠色婷婷综合天天久久丁香 | 欧亚在线视频 | 欧美成人激情在线 | 69精品在线观看 | 99久久精品国产9999高清 | 一级毛片人与动免费观看 | 欧美成人猛男性色生活 | 草草影院国产第一页 | 精品乱码一区二区三区在线 | 国产疯狂露脸对白 | 狠狠色婷婷丁香综合久久韩国 | 四虎亚洲 | 国产麻豆之光e奶女教师 | 久久久综合中文字幕久久 | 亚洲日本在线观看视频 | 国产福利视频在线 | 手机在线看片不卡中文字幕 | 国产在线成人精品 | 日本囗交做爰视频欧美 | 欧美日韩久久毛片 | 久久综合久久久久 | 成人精品免费视频 | 日本中文字幕在线看 |