apt-get install iptables
/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 /sbin/iptables-save
iptables -L -t nat
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
in case you want to manually remove rule number 1
iptables -t nat -D POSTROUTING 1
apparently postrouting to change the port is not exactly allowed?
Another common alternative is MASQUERADE so all ip addresses are modified to seem to come from the router
iptables -t nat -A POSTROUTING -j MASQUERADE -o eth1 -i eth0
apparently masquerade is being deprecated in favor of SNAT
Running JSP Through Apache: mod_jk2
Often customers want to combine the use of JSP and Apache. For example, they may have some PHP scripts and some JSP programs they want to run. (And the Servlet engines cannot execute PHP scripts). Using Apache to handle your incoming requests also gives you more options for things like using SSL, error logs, and using .htaccess files.
The answer is to use the Apache mod_jk2 module. It intercepts Apache requests to certain URLs and forwards them to your Servlet engine. For example, it can hand off requests to certain "mount points" like /jsp to your Servlet engine. It can also hand off certain file types (e.g. *.jsp) to your Servlet engine.
mod_jk2 forwards the Apache requests to your Servlet engine via a socket using a protocol called ajp13. Both Tomcat and Jetty support the ajp13 protocol.