By James Cooley - December 07 2006 tags: apache

I want to use tomcat and turbogears together so I decided to front tomcat and turbogears with apache. I moved from to fedora 4 to 5 lastnight only to find that my mod_jk configuration is not longer supported and I now have to use mod_proxy_ajp. This leads to a lot of apache restarts which leads to service interruption.

A nice trick it to use iptables to redirect all port 80 traffic directly to tomcat while you are doing this.

First off backup you current iptables config with

sudo /sbin/iptables-save > ~/firewall-config
so you can restore with
sudo /sbin/iptables-restore < ~/firewall-config
when you are finished. I use the following to redirect port 80 to my tomcat on 6980:
sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 6080
You can check the current iptables config with
sudo /sbin/service iptables status
I think its pretty seamless way of testing apache startup while not having to configure another server on port 80 while you are doing it. It's not really something for production machines but it is a nice hack.