Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Tomcat on AWS EC2 available from outside localhost

I'm trying to run Tomcat on an AWS Linux server. I've installed Tomcat, and tested it from the command line to make sure it's working, but I can't access it from another machine. The details:

  1. The instance has port 80 incoming for HTTP open in the security group.
  2. I have verified that it's running on port 80 by telnetting into localhost on that port and doing a GET request.
  3. I tried adding the public DNS as an alias for localhost in server.xml then restarting to make sure the changes are picked up.

Yet if I try to access it via my browser (outside the actual server) using the public DNS I get "could not connect".

Any ideas?

Thanks...

like image 281
NickChase Avatar asked Jul 28 '11 17:07

NickChase


2 Answers

OK, the problem turned out to be that I also needed to edit and restart iptables, as explained here: http://cyberciti.biz/faq/howto-rhel-linux-open-port-using-iptables

like image 99
NickChase Avatar answered Sep 19 '22 18:09

NickChase


Adding what is not mentioned in above answers.

For me, allowing TCP over 8080 was missing. So, I have created new Inbound rule with following details:

  • Type : Custom TCP Rule
  • Protocol : TCP
  • Port Range : 8080
  • Source : Anywhere

This worked for me. Hope it may help someone. :)

like image 43
ms_27 Avatar answered Sep 19 '22 18:09

ms_27