Linux下Apache2+Tomcat5.0整合方案

服务器已有安装有Tomcat5.0和JDK1.4.2
Tomcat5.0目录:/home/Oracle/tomcat
JDK 1.4.2目录:/home/oracle/j2sdk1.4.2_07
Tomcat5.0 和 JDK1.42 安装步骤略
安装Apache2.0.59至/home/oracle/apache
下载httpd-2.0.59.tar.gz上传至/home/oracle
cd /home/oracle
tar -zxvf httpd-2.0.59.tar.gz
cd httpd-2.0.59
#配置(prefix是安装路径,enable-mods-shared=all表示编译配置所有so文件)
./configure --prefix=/home/oracle/apache --enable-mods-shared=all
make
make install
#配置httpd.conf
vi /home/oracle/apache/conf/httpd.conf
ServerName 配置为 127.0.0.1,服务器IP或域名
DirectoryIndex 中添加index.htm index.jsp
DefaultLanguage 设置为zh-CN
cd /home/oracle/apache/bin
./apachectl start
打开 看见 "安装Apache的测试页面" 说明Apache已经安装成功
如果出现"403 Forbidden错误"(而且httpd.conf未设置不允许访问),解决方法如下:
不但要将WEB目录设置为可读,还要将WEB目录的所有父级目录设置为至少可检索
chmod +x /home
chmod +x /home/oracle
chmod +x /home/oracle/apache
chmod 777 -R /home/oracle/apache/htdocs
编译和设置mod_jk2

下载jakarta-tomcat-connectors-jk2-src-current.tar.gz,放至/home/oracle
tar zxvf jakarta-tomcat-connectors-jk2-src-current.tar.gz
cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
./buildconf.sh
./configure --with-apxs2=/home/oracle/apache/bin/apxs --with-java-home=/home/oracle/j2sdk1.4.2_07
make jk2-build-apxs
cd server/apache2
make -f Makefile.apxs install
成功执行完这几步骤之后,mod_jk2已经装好,接下来是配置阶段。
在/home/oracle/apache/conf目录下建立workers2.properties文件,内容如下
#---- worker2.properties
[logger.apache2]
level=DEBUG
# Shared memory handling. Needs to be set.
[shm]
file=/home/oracle/apache/logs/shm.file
size=1048576
# Example socket channel, explicitly set port and host.
[channel.socket:localhost:8009]
tomcatId=localhost:8009
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
#[status:status]
# Uri mapping
#[uri:/jkstatus/*]
#group=status:status
#[uri:/jsp-examples/*]
#group=ajp13:localhost:8009
#[uri:/servlets-examples/*]
#group=ajp13:localhost:8009
#[uri:/javaapp/*]
#group=ajp13:localhost:8009
#[uri:*.jsp]
#worker=ajp13:localhost:8009
#[uri:10.0.0.10/*]
#worker=ajp13:localhost:8009
#[uri:/*.do]
#worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
#---- end of workers2.properties

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwwfsz.html