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 ...
随机推荐
- 小米监控 open-falcon部署
具体详情请参考官方文档 http://book.open-falcon.org/zh_0_2/quick_install/ centos6.8 建议centos7系统 否则后面按照官方 ...
- [01] radio ,checkbox 表单文字对齐
http://www.cnblogs.com/wangsir015/p/5555818.html 这几天在做表单时总会碰到复选框(checkbox)和单选框(radio)与文字不对齐的问题,要不是ch ...
- UVA1218 Perfect Service
Time Limit: 3000MS 64bit IO Format: %lld & %llu /*by SilverN*/ #include<iostream> #inc ...
- 【CodeChef】PARADE(费用流,最短路)
题意: 思路: #include<cstdio> #include<iostream> #include<algorithm> #include<cstrin ...
- 图片定位 css
原文发布时间为:2009-07-14 -- 来源于本人的百度文章 [由搬家工具导入] 原图片:http://cache.soso.com/wenwen/i/w_icon.gif 从这图片定位几张图片出 ...
- javascript提示框,随着鼠标移动
原文发布时间为:2009-04-23 -- 来源于本人的百度文章 [由搬家工具导入] <html><script type="text/javascript"&g ...
- js scrollTop, 滚动条操作
设置页面加载时滚动条自动滚到底的方法: jQuery: 复制代码 代码如下: $(function(){ var h = $(document).height()-$(window).height() ...
- 前端知识点总结——CSS
1.CSS的概述 1.什么是CSS? CSS:Cascading Style Sheets层叠样式表,级联样式表(简称:样式表) 2.作用 设置HTML网页元素的样式 3.HTML与CSS的关系 HT ...
- 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---20
以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:
- python for循环及常用函数
python for循环 格式: for iterating_var in sequence: statements(s) ###################################### ...