How to Redirect Your Tomcat or JBoss Over Port 80
This article is for customers with a dedicated server, VPS or Cloud VPS.
There is more than one way to handle this. Below is one such method that works well on a production based environment for both Apache Tomcat and JBoss.
- Apache httpd and httpd-devel installed
- Tomcat or JBoss installed and running on port 8080.
- Root or sudo access.
Install Tomcat Connector 1.2 (mod_jk)
# wget http://opensource.become.com/apache//tomcat/tomcat-connectors/jk/source/jk-1.2.31/tomcat-connectors-1.2.31-src.tar.gz
# tar xvzftomcat-connectors-1.2.31-src.tar.gz
# cd tomcat-connectors-1.2.31/native
# ./configure --with-apxs=/usr/sbin/apxs
# su -c 'make install'
# cd ../conf/
# cp httpd_jk.conf /etc/httpd/conf.d/
# cp workers.properties /etc/httpd/conf/
Edit /etc/httpd/conf/workers.properties so that it has the following worker info after the manager entries:
worker.list=worker1 (for first worker)
The port 8009 is the port found in tomcats coyote connector port in tomcat/conf/server.xml. Its also the same port for jboss using ports-default.
Finally you need to edit your virtualhost entry in either httpd.conf or its own file in /etc/httpd/conf.d/ (best practice is to use use separate file for each domain in /etc/httpd/con.d/)
Add the following JkMounts to your virtualhost entry just before the closing VirtualHost tag:
worker.worker2.port=8109 (Updated port which must be unique as with 8080/8180)
If you don't want the hassle of managing your Tomcat environment yourself, start using a Java web host today.