Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

First, I just want to see it is not a security group setup in ec2 console. because I can set up the apache, which is by fault 80 port and is able to visit the apache website through 80 port. but for tomcat, it works if I use port 8080(by default) or some values bigger than 1023(i think this port). but when I change server.xml(changing 8080 to 80) it cannot work if I use 80 port, I start the service successfully, but there is no 80/http listening. I know it should be some privileges issues(only the root can start service below 1023 port). but I did not know how to do it.

1 Answer

0 votes
by (44.3k points)

The solution would redirect all traffic from the port 80 to the port on which Tomcat is running on. We can use iptables to do that:

/sbin/iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT

/sbin/iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT

/sbin/iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

Related questions

0 votes
1 answer
asked Jul 12, 2019 in AWS by Amyra (12.9k points)

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
asked Jul 31, 2019 in Java by Anvi (10.2k points)

Browse Categories

...