Monday, 30 July 2007
Getting mod_jk to work
« Checking out JPackage | Main | mod_proxy_ajp: Simpler than mod_jk »This blog is now accessible at http://blog.bwtaylor.com . To make this work I did three things:
- I added blog.bwtaylor.com to my DNS
- I set up mod_jk and configured it to route the virtual host blog.bwtaylor.com to the AJP1.3 connector on port 8009
- I added a redirect in index.html at higher levels to go to the blogsom/blog/spout context path
These three steps are all you have to do to have simple apache tomcat integration so that tomcat access that is normally on port 8080 is added to the regular apache URL namespaces.
The mod_jk setup was pretty easy. After downloading the appropriate mod_jk binary from a mirror like this one and symlinking it to the name mod_jk.so in the apache modules directory, I added this to /etc/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
Then I created a workers.properties file under /etc/httpd/conf like so:
# List workers
worker.list=tomcatWorker
# Define wrkr
worker.tomcatWorker.port=8009
worker.tomcatWorker.host=localhost
worker.tomcatWorker.type=ajp13
worker.tomcatWorker.cachesize=10
worker.tomcatWorker.cache_timeout=600
worker.tomcatWorker.socket_timeout=300
and finally I finished off the connection by adding mod_jk.conf under /etc/httpd/conf.d for the virtual hosting rules:
JkWorkersFile /etc/httpd/conf/workers.properties
JkShmFile /var/log/httpd/mod_jk.shm
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
NameVirtualHost *:80
<VirtualHost blog.bwtaylor.com:80>
DocumentRoot /opt/tomcat/webapps
ErrorLog /var/log/httpd/mod_jk-error.log
CustomLog /var/log/httpd/mod_jk-access.log common
<LocationMatch ".*WEB-INF.*">
AllowOverride None
deny from all
</LocationMatch>
JkMount /* tomcatWorker
</VirtualHost>
Technorati Tags: mod_jk apache tomcat
Posted by at 8:07 PM in stuff about java
[Trackback URL for this entry]
