跳至主要內容

[linux] apache 和 tomcat 共用 80 port

Install mod_jk:
apt-get install libapache2-mod-jk
Create workers.properties in /etc/apache2/ and add the following into it:
# this lives in /etc/apache2/workers.properties
# workers.properties – ajp13
#
# List workers
worker.list=worker1
# Define worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
Edit your apache2 config in /etc/apache2/apache2.conf and add this to the end:
# tomcat connector stuff:
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat “[%a %b %d %H:%M:%S %Y]
In your /etc/apache2/sites-enabled/ dir find the vhost you want to use tomcat and edit it, at the end of the vhost declaration put:
#Everything under root goes to tomcat
JkMount /* worker1
#html files should be served by apache2
JkUnMount /*.html worker1
Edit /etc/tomcat6/server.xml and make sure that the ajp connector is uncommented:

restart tomcat: /etc/init.d/tomcat6 restart
restart apache: /etc/init.d/apache2 restart
navigate to yourdomain.com/ and you should be all tomcatted
reference: http://notetodogself.blogspot.com/2011/02/linode-how-to-install-modjk-tomcat.html

分類:linux
由 Compete Themes 設計的 Author 佈景主題