Linux 下Apache 和Tomcat 整合 mod_jk

apache-tomcat-7.0.6.tar.gz

apache-tomcat-7.0.6.tar.gz

httpd-2.2.17.tar.gz

httpd-2.2.17.tar.gz

jdk-6u23-linux-i586.bin

jdk-6u23-linux-i586.bin

tomcat-connectors-1.2.31-src.tar.gz

tomcat-connectors-1.2.31-src.tar.gz

1.安装httpd

1个apache  2个tomcat在一台机器上,修改其中一个tomcat相关端口,对应如下

tar zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache2 --enable-so
make && make install

8080     8980

2.安装JDK

8005     8905

chmod +x jdk-6u18-linux-i586.bin
./jdk-6u18-linux-i586.bin
mv jdk1.6.0_18 /usr/local/jdk
rm -rf /usr/bin/java
rm -rf /usr/bin/javac
ln -s /usr/local/jdk/bin/java /usr/bin/java
ln -s /usr/local/jdk/bin/javac /usr/bin/javac

8009     8909

[root@CentOSlamp
src]# java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

4000     4001

ln -s /usr/local/jdk/jre /usr/local/jre

1.安装httpd

设置环境变量

tar zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache2 --enable-so
make && make install

vi /etc/profile 添加如下内容

2.安装JDK

JAVA_HOME=/usr/local/jdk
export JAVA_HOME
JRE_HOME=/usr/local/jre
export JRE_HOME

chmod +x jdk-6u18-linux-i586.bin
./jdk-6u18-linux-i586.bin
mv jdk1.6.0_18 /usr/local/jdk
rm -rf /usr/bin/java
rm -rf /usr/bin/javac
ln -s /usr/local/jdk/bin/java /usr/bin/java
ln -s /usr/local/jdk/bin/javac /usr/bin/javac

运行,使环境变量生效

[root@CentOSlamp
src]# java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

source /etc/profile

ln -s /usr/local/jdk/jre /usr/local/jre

3.安装tomcat

设置环境变量

tar zxvf apache-tomcat-7.0.6.tar.gz
mv apache-tomcat-7.0.6 /usr/local/tomcat

vi /etc/profile 添加如下内容

4.安装tomcat-connectors

JAVA_HOME=/usr/local/jdk
export JAVA_HOME
JRE_HOME=/usr/local/jre
export JRE_HOME

tar zxvf tomcat-connectors-1.2.31-src.tar.gz

运行,使环境变量生效

cd tomcat-connectors-1.2.31-src/native/

source /etc/profile

./configure --with-apxs=/usr/local/apache2/bin/apxs
--with-java-home=/usr/local/jdk
make && make install

3.安装tomcat

  1. 配置httpd.conf 文件

tar zxvf apache-tomcat-7.0.6.tar.gz
mv apache-tomcat-7.0.6 /usr/local/tomcat1

vi /usr/local/apache2/conf/httpd.conf

tar zxvf apache-tomcat-7.0.6.tar.gz
mv apache-tomcat-7.0.6 /usr/local/tomcat2

添加

4.安装tomcat-connectors

LoadModule jk_www.98455.com,module modules/mod_jk.so

tar zxvf tomcat-connectors-1.2.31-src.tar.gz

<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn
</IfModule>

cd tomcat-connectors-1.2.31-src/native/

6.创建并配置workers.properties文件

./configure --with-apxs=/usr/local/apache2/bin/apxs
--with-java-home=/usr/local/jdk
make && make install

相关文章

Comment ()
评论是一种美德,说点什么吧,否则我会恨你的。。。