If you don't have tomcat7 installed run:
aptitude install tomcat7
Configure Tomcat
------------------
Edit /var/lib/tomcat7/conf/server.xml
Uncomment the line:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
to tell Tomcat to use connector protocol on port 8009 for connection with Apache.
Restart tomcat:
/etc/init.d/tomcat7 restart
Check whether the connector is working with:
netstat -ln | grep :8009
Configure Apache
------------------
Install module for apache which will be used to connect to Tomcat:
apt-get install libapache2-mod-jk
Edit /etc/apache2/sites-available/default
and add JkMountCopy On in the <VirtualHost *:80> section
...
DocumentRoot /var/www
JkMountCopy On
...
Edit /etc/apache2/mods-enabled/jk.conf
<IfModule jk_module>
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkShmFile /var/log/apache2/jk-runtime-status
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /YouApplicationName/* ajp13_worker
JkMount /YouApplicationName ajp13_worker
</IfModule>
Note:
---------
the path should be accessible from Tomcat7 under the same application name as well. i.e:
localhost:8080/YourApplicationName
This is because Apache hosts your tomcat7's specific path.
Thanks, it helped a lot!
ReplyDelete