系统环境:CentOS 5.8 x86_64
应用软件:所以应用软件都放在/usr/local/src目录下
nginx-1.2.2.tar.gz
yaoweibin-nginx_ajp_module-v0.2.5-17-ge971b84.zip
pcre-8.12.tar.gz
apache-tomcat-7.0.27.tar.gz
jdk-7u4-linux-x64.gz
apr-1.4.5.tar.gz
apr-iconv-1.2.1.tar.gz
apr-util-1.3.10.tar.gz
tomcat-native-1.1.23
各应用软件官方站点:
nginx:
nginx_ajp: https://github.com/yaoweibin/nginx_ajp_module
pcre:
apache-tomcat:
jdk: Oracle.com/technetwork/Java/javase/downloads/index.html
所需服务器:
server1:nginx服务器192.168.8.10 -->安装nginx,作为分发器
server2:jvm1服务器192.168.8.11 -->安装apache-tomcat、jdk
server3:jvm2服务器192.168.8.12 -->安装apache-tomcat、jdk
二、安装nginx+ajp
1.建立运行用户 groupadd www useradd -g www -s /sbin/nologin -M www cd /usr/local/src 2.安装pcre tar zxf pcre-8.12.tar.gz cd pcre-8.12 ./configure make ; make install 3.安装nginx_ajp和nginx unzip yaoweibin-nginx_ajp_module-v0.2.5-17-ge971b84.zip tar zxf nginx-1.2.2.tar.gz cd nginx-1.2.2 patch -p1 < ../yaoweibin-nginx_ajp_module-e971b84/ajp.patch ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --without-mail_pop3_module --without-mail_imap_module --without-http_uwsgi_module --without-http_scgi_module --without-http_memcached_module --without-http_autoindex_module --without-http_ssi_module --add-module=../yaoweibin-nginx_ajp_module-e971b84 make ; make install三、安装tomcat、jdk
1.安装tomcat cd /usr/local/src tar zxf apache-tomcat-7.0.27.tar.gz mv apache-tomcat-7.0.27 /usr/local/tomcat 2.安装jdk tar zxf jdk-7u4-linux-x64.gz mv jdk1.7.0_04 /usr/local/jdk 3.设置java、tomcat运行环境变量 vi /etc/profile 在文件最后加入如下内容: #Set java & tomcat Environment JAVA_HOME=/usr/local/jdk export JAVA_HOME JRE_HOME=/usr/local/jdk/jre export JRE_HOME CLASSPATH=/usr=/usr/local/tomcat/common/lib/:/usr/local/jdk/lib:/usr/local/jdk/jre/lib export CLASSPATH PATH=$PATH:/usr/local/tomcat/bin/:/usr/local/apache/bin:/usr/local/jdk/bin:/usr/local/jdk/jre/bin export PATH TOMCAT_HOME=/usr/local/tomcat export TOMCAT_HOME 让环境变量立即生效: source /etc/profile四、安装apr、native
(1)安装apr wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz tar zxf apr-1.4.5.tar.gz cd apr-1.4.5 ./configure --prefix=/usr/local/apr make make install (2)安装apr-iconv wget http://archive.apache.org/dist/apr/apr-iconv-1.2.1.tar.gz tar -zxf apr-iconv-1.2.1.tar.gz cd apr-iconv-1.2.1 ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr make make install (3)安装apr-util wget http://archive.apache.org/dist/apr/apr-util-1.3.10.tar.gz tar zxf apr-util-1.3.10.tar.gz cd apr-util-1.3.10 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr --with-apr-iconv=/usr/local/apr-iconv/bin/apriconv make make install (4)安装tomcat-native 安装好tomcat7之后,tomcat-native已经在tomcat的bin目录下了,可以直接使用 cd /usr/local/tomcat/bin tar zxf tomcat-native.tar.gz cd tomcat-native-1.1.23-src/jni/native ./configure --with-apr=/usr/local/apr --with-java-home=/usr/local/jdk make make install (5)设置 apr 的环境变量:vi /etc/profile在文件后面添加以下内容:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib 让配置生效: source /etc/profilePS:对于为什么要安装apr和native,是apache-tomcat-7.0.27这个版本需要这些包的支持,不然启动会出现如下错误:
cat /usr/local/tomcat/logs/catalina.out
Jul 27, 2012 7:19:34 PM org.apache.catalina.core.AprLifecycleListener init