centos-64整合nginx和tomcat
centos-64整合nginx和tomcat
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的更多相关文章
- 在CentOS上使用Nginx和Tomcat搭建高可用高并发网站
目录 目录 前言 创建CentOS虚拟机 安装Nginx 安装Tomcat 安装lvs和keepalived 反向代理 部署网站 搭建数据库 编写网站项目 解决session一致性 注意 参考资料 前 ...
- CentOS 5.5 Nginx+JDK+MySQL+Tomcat(jsp)成功安装案例
在CentOS 5.5中安装Nginx+jdk+mysql+tomcat是非常容易的.只需yum安装环境包和nginx.解压安装jdk和tomcat.配置profile文件.server.xml和ng ...
- CentOS Nginx+jdk+tomcat 环境搭建
一.jdk安装 jdk下载地址:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloa ...
- Centos6.2上做nginx和tomcat的集成及负载均衡(已实践)
Centos6.2上做nginx和tomcat的集成及负载均衡 ---------------------------------------------------------Jdk-------- ...
- nginx代理tomcat
http://blog.csdn.net/kongqz/article/details/6838989 http://www.800l.com/linux-nginx-tomcat-jdk.html ...
- 在CentOS下企图整合Apache和Tomcat依然失败
环境: 64位CentOS Linux version 2.6.32-431.el6.x86_64 CentOS release 6.5 (Final) Apache/2.2.15,mod_jk/1 ...
- 压力测试工具ab及centos下单独安装方法 nginx和tomcat静态资源的性能测试
Apache安装包中自带的压力测试工具Apache Benchmark(简称ab)简单易用,这里采用ab作为压国测试工具. 独立安装: ab运行需要信赖apr-util包: # yum install ...
- nginx于tomcat项目整合(拆分静态文件)
1.在很多时候我们在网站上应用的时候都会用到nginx,由于我们是java开发者,不可避免的是我们需要在我们的tomcat的工程中应用到nginx,这里的应用可以是请求转发,负载均衡,反向代理,配置虚 ...
- nginx与tomcat整合
nginx与tomcat整合 1. 在/usr/local/nginx/conf下面添加文件proxy.conf # cat /usr/local/nginx/confg/proxy.conf p ...
随机推荐
- Codeforces Round #361 (Div. 2) B bfs处理
B. Mike and Shortcuts time limit per test 3 seconds memory limit per test 256 megabytes input standa ...
- Python之面向对象:封装
1.封装的概念 将对象的数据与操作数据的方法相结合,通过方法将对象的数据与实现细节保护起来,就称为封装.外界只能通过对象的方法访问对象,因此封装同时也实现了对象的数据隐藏. 在使用面向对象的封装特性时 ...
- express中放置静态文件
不使用模版引擎的话要直接添加html,可以使用express.static()中间件设定静态文件目录,然后将html文件放在里面,如:express默认静态文件目录为 app.use(express. ...
- Eat the Trees(hdu 1693)
题意:在n*m的矩阵中,有些格子有树,没有树的格子不能到达,找一条或多条回路,吃完所有的树,求有多少中方法. 第一道真正意义上的插头DP,可参考陈丹琦的<基于连通性状态压缩的动态规划问题> ...
- javascript实现可拖动DIV层
原文发布时间为:2009-05-04 -- 来源于本人的百度文章 [由搬家工具导入] 注意以下红色部分是关键.如果不使用 document.documentElement,而使用docume ...
- FCKeditor2.6.4控件及其使用范例
原文发布时间为:2009-06-14 -- 来源于本人的百度文章 [由搬家工具导入] 已经精简了,很小,不多说了,我的源代码去下载看。 web.config 看看。。。还有bin里面的dll就是控件, ...
- [LeetCode] Gas Station 贪心
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...
- formal parameter
formal parameter : [3.16] object declared as part of a function declaration or definition that acqui ...
- 解决IE6的PNG透明
http://www.jb51.net/article/35669.htm http://blog.csdn.net/mosliang/article/details/6760028
- 【BZOJ1562】【jzyzOJ1730】【COGS409】NOI2009变换序列 二分图匹配
[问题描述] 对于N个整数0, 1, ……, N-1,一个变换序列T可以将i变成Ti,其中 定义x和y之间的距离.给定每个i和Ti之间的距离D(i,Ti), 你需要求出一个满足要求的变换 ...