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

centos-64整合nginx和tomcat

系統 1969 0

centos-64整合nginx和tomcat

分類: Linux 128人閱讀 評論 (0) 收藏 舉報

1、安裝wget和依賴包
yum install wget
yum install make gcc gcc-c++ autoconf automake
yum install zlib zlib-devel openssl openssl-devel pcre pcre-devel


2、創建nginx目錄并下載nginx最新穩定版本
mkdir /home/nginx/
wget nginx.org/download/nginx-1.2.8.tar.gz


3、解壓并查看nginx的配置幫助
tar xvzf nginx-1.2.8.tar.gz
cd /home/nginx/nginx-1.2.8
[root@nignx nginx-1.2.8]# ./configure --help


4、配置nginx的安裝選項
./configure
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/




Configuration summary
? + using system PCRE library
? + OpenSSL library is not used
? + md5: using system crypto library
? + sha1: using system crypto library
? + using system zlib library


? nginx path prefix: "/usr/local/nginx"
? nginx binary file: "/usr/local/nginx/sbin/nginx"
? nginx configuration prefix: "/usr/local/nginx/conf"
? nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
? nginx pid file: "/usr/local/nginx/logs/nginx.pid"
? nginx error log file: "/usr/local/nginx/logs/error.log"
? nginx http access log file: "/usr/local/nginx/logs/access.log"
? nginx http client request body temporary files: "client_body_temp"
? nginx http proxy temporary files: "proxy_temp"
? nginx http fastcgi temporary files: "fastcgi_temp"
? nginx http uwsgi temporary files: "uwsgi_temp"
? nginx http scgi temporary files: "scgi_temp"


5、安裝
make && make install


6、啟動、重啟、停止nginx(注意安裝目錄)
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf//nginx.conf
/usr/local/nginx/sbin/nginx -s reload
pkill -9 nginx


7、關閉防火墻(或者添加80端口的規則)
service iptables stop


8、配置jdk和tomcat
wget http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin


chmod +x jdk-6u45-linux-x64.bin
mv jdk1.6.0_45/ /usr/local/jdk
vi /etc/profile添加如下內容
JAVA_HOME="/usr/local/jdk"
CLASS_PATH="$JAVA_HOME/lib:$JAVA_HOME/jre/lib"
PATH=".:$PATH:$JAVA_HOME/bin"
CATALINA_HOME="/usr/local/tomcat"
export JAVA_HOME CATALINA_HOME
source /etc/profile使得配置生效


wget http://mirror.esocc.com/apache/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz
tar zxvf apache-tomcat-6.0.36.tar.gz
mv apache-tomcat-6.0.36 /usr/local/tomcat
cp -rf /usr/local/tomcat/webapps/* /home/www/
vi /usr/local/tomcat/conf/server.xml修改appBase="webapps"為appBase="/home/www/",即網頁根目錄


9、配置nginx.conf
vi /usr/local/nginx/conf/nginx/conf
[root@nignx conf]# cat nginx.conf


#user ?nobody;
worker_processes ?2;


#error_log ?logs/error.log;
#error_log ?logs/error.log ?notice;
#error_log ?logs/error.log ?error;


#pid ? ? ? ?logs/nginx.pid;


events {
? ? use epoll;
? ? worker_connections ?1024;
}


http {
? ? include ? ? ? mime.types;
? ? default_type ?application/octet-stream;


? ? #log_format ?main ?'$remote_addr - $remote_user [$time_local] "$request" '
? ? # ? ? ? ? ? ? ? ? ?'$status $body_bytes_sent "$http_referer" '
? ? # ? ? ? ? ? ? ? ? ?'"$http_user_agent" "$http_x_forwarded_for"';


? ? #access_log ?logs/access.log ?main;


? ? sendfile ? ? ? ?on;
? ? tcp_nopush ? ? on;


? ? keepalive_timeout ?65;


? ? gzip ?on;
? ? gzip_http_version 1.0;
? ? gzip_min_length 1000;
? ? gzip_buffers 4 32k;
? ? gzip_comp_level 5;
? ? gzip_disable "MSIE [1-6].";
? ? gzip_types text/plain application/x-javascript text/css text/javascript application;
? ? gzip_vary on;


? ? upstream tomcat_server {
? ? ? ? server 127.0.0.1:8080;
? ? }


? ? server {
? ? ? ? listen ? ? ? 80;
? ? ? ? server_name ?localhost;


? ? ? ? #charset koi8-r;
? ? ? ? #access_log ?logs/host.access.log ?main;


? ? ? ? root ? /home/www/webapps;


? ? ? ? location /manageUI/ {
? ? ? ? ? ? index /home/www/ROOT/test.jsp;
? ? ? ? ? ? proxy_pass http://tomcat_server;
? ? ? ? ? ? proxy_set_header Host $host;
? ? ? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? ? ? ? ? proxy_set_header Via "nginx";
? ? ? ? }


? ? ? ? #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 ? html;
? ? ? ? }
? ? }
}

以上就完成了nginx和tomcat的整合

centos-64整合nginx和tomcat


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

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

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

【本文對您有幫助就好】

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

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲女bbwxxxx另类 | 日韩黄a级成人毛片 | 大片毛片女女女女女女女 | 久久婷婷国产综合精品 | 青草青青在线视频观看 | 26uuu另类亚洲欧美日本一 | 狼人久久尹人香蕉尹人 | 99精品国产一区二区青青牛奶 | 一级女人18毛片免费 | 欧美日韩成人高清色视频 | 日本久久网站 | 免费看美女隐私的网站 | 四虎影视库国产精品一区 | 久久青 | 国产免费一区二区三区在线观看 | 国产一区二区在线观看视频 | 亚洲一级毛片免费观看 | 精品精品国产理论在线观看 | 免费一级毛片在线播放不收费 | 久久久久夜夜夜精品国产 | 九九九热精品 | 中文字幕亚洲一区二区va在线 | 成熟日本语热亚洲人 | 国产成人精品久久综合 | 亚洲精品日韩中文字幕久久久 | 久久国产精品国产自线拍免费 | 最新中文字幕一区 | 精品牛牛影视久久精品 | 日本黄色网址视频 | 日本中文一区 | 久久做 | 欧美a在线| 亚洲精品高清在线一区二区三区 | 老湿机午夜影院 | 人人狠狠综合久久亚洲 | 久久在精品线影院精品国产 | 日本h在线精品免费观看 | 中文字幕亚洲欧美一区 | 色鬼久久爱综合久久鬼色 | 内衣办公室动漫久久影院 | 国产萝控精品福利视频免费 |