Happy FOSS

Opensource, Technology, Programming & Computer Science

Port forwarding 80 to Tomcat port

For security reason Tomcat doesnt run on port 80.

The simple trick is to write an iptable rule to perform the port forwarding request arriving at port 80 to Tomcat port (say 8080).

Write the following content to the a shell script file say tomcat_firewall.sh

/sbin/iptables -A FORWARD -p tcp –destination-port 80 -j ACCEPT

/sbin/iptables -t nat -A PREROUTING -j REDIRECT -p tcp –destination-port 80 –to-ports 8080

And add this script as root in /etc/rc.local as shown below, this ensures the setting is done whenever the server startsup.

su – root “/path-to-the-file/tomcat_firewall.sh

Advertisements

August 26, 2008 - Posted by | Internet, Linux |

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: