日期:2014-05-16  浏览次数:20708 次

ubuntu apache整合tomcat
1.安装apache

  sudo apt-get install apache2
  sudo /etc/init.d/apache2 restart

2.cd /etc/apache2/mods-available
  sudo vi jk.conf
  
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions  +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

3.sudo vi /etc/libapache2-mod-jk/workers.properties

#指定tomcat路径
workers.tomcat_home=/home/robosay/intelligentSystem/project-master/tomcat-chat

#指定jdk路径
workers.java_home=/home/robosay/intelligentSystem/project-master/jdk1.6.0_45

worker.list=worker1,worker2

# Set properties for worker1
worker.worker1.type=ajp13 
worker.worker1.host=172.17.226.252
worker.worker1.port=8080
worker.worker1.lbfactor=50 
worker.worker1.cachesize=10 
worker.worker1.cache_timeout=600 
worker.worker1.socket_keepalive=1 
worker.worker1.socket_timeout=300

# Set properties for worker2
worker.worker2.type=ajp13 
worker.worker2.host=172.17.226.252
worker.worker2.port=8080
worker.worker2.lbfactor=50 
worker.worker2.cachesize=10 
worker.worker2.cache_timeout=600 
worker.worker2.socket_keepalive=1 
worker.worker2.socket_timeout=300

4.sudo vi /etc/apache2/sites-available/default

JKMount /* ajp13_worker

5.启用jk模组及其配置
sudo a2enmod jk
启用include和rewrite模块
sudo a2enmod include
sudo a2enmod rewrite

6.修改tomcat /conf/server.xml 加入protocol="AJP/1.3"

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />