tomcat绑定apache
时间:2007-01-17 来源:supersuper
操作系统
RHEL4
步骤
1 安装jdk
jdk-1_5_0_10-linux-i586-rpm.bin
2 安装apache的apxs模块
apr-devel-0.9.4-24.1.i386.rpm
apr-util-devel-0.9.4-17.i386.rpm
pcre-devel-4.5-3.i386.rpm (pcre-devel-4.5-3.2.RHEL4.i386.rpm)
httpd-devel-2.0.52-22.ent.i386.rpm
3 编译jk_mod.so文件
apache-tomcat-5.5.20.tar.gz
tomcat-connectors-1.2.18-src.tar.gz
cd tomcat-connectors-1.2.18-src/native/
./configure --with-apxs=/usr/bin/apxs
make && make install
4 编辑环境变量文件
vi /etc/profile
JAVA_HOME=/usr/java/jdk1.5.0_10
export PATH=.:$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$CLASSPATH
export CATALINA_HOME=/opt/tomcat
export PATH=$CATALINA_HOME/bin:$PATH
在tomcat的startup.sh和shutdown.sh脚本里添加
export JAVA_HOME=/usr/java/jdk1.5.0_10
5 编辑tomcat的配置文件
A
vi /etc/httpd/conf.d/tomcat.conf
如下
LoadModule jk_module modules/mod_jk.so
DirectoryIndex index.jsp
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile /etc/httpd/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /*.jsp worker1
B
vi /etc/httpd/conf.d/workers.properties
如下
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300
6 编辑tomcat的apache的虚拟主机
vi /etc/httpd/vhost_test.conf
NameVirtualHost *:80
<VirtualHost *:80>
<Directory "/opt/tomcat/webapps/jira" >
DirectoryIndex index.htm index.html default.jsp index.php
</Directory>
DocumentRoot /opt/tomcat/webapps/jira
ServerName 192.168.239.129
ErrorLog logs/jira.error.log
CustomLog logs/jira.access.log common
</VirtualHost>
RHEL4
步骤
1 安装jdk
jdk-1_5_0_10-linux-i586-rpm.bin
2 安装apache的apxs模块
apr-devel-0.9.4-24.1.i386.rpm
apr-util-devel-0.9.4-17.i386.rpm
pcre-devel-4.5-3.i386.rpm (pcre-devel-4.5-3.2.RHEL4.i386.rpm)
httpd-devel-2.0.52-22.ent.i386.rpm
3 编译jk_mod.so文件
apache-tomcat-5.5.20.tar.gz
tomcat-connectors-1.2.18-src.tar.gz
cd tomcat-connectors-1.2.18-src/native/
./configure --with-apxs=/usr/bin/apxs
make && make install
4 编辑环境变量文件
vi /etc/profile
JAVA_HOME=/usr/java/jdk1.5.0_10
export PATH=.:$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$CLASSPATH
export CATALINA_HOME=/opt/tomcat
export PATH=$CATALINA_HOME/bin:$PATH
在tomcat的startup.sh和shutdown.sh脚本里添加
export JAVA_HOME=/usr/java/jdk1.5.0_10
5 编辑tomcat的配置文件
A
vi /etc/httpd/conf.d/tomcat.conf
如下
LoadModule jk_module modules/mod_jk.so
DirectoryIndex index.jsp
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile /etc/httpd/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /*.jsp worker1
B
vi /etc/httpd/conf.d/workers.properties
如下
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300
6 编辑tomcat的apache的虚拟主机
vi /etc/httpd/vhost_test.conf
NameVirtualHost *:80
<VirtualHost *:80>
<Directory "/opt/tomcat/webapps/jira" >
DirectoryIndex index.htm index.html default.jsp index.php
</Directory>
DocumentRoot /opt/tomcat/webapps/jira
ServerName 192.168.239.129
ErrorLog logs/jira.error.log
CustomLog logs/jira.access.log common
</VirtualHost>
相关阅读 更多 +