user2212726
user2212726

Reputation: 1285

can't connect to ec2 tomcat localhost

I've followed a lot of tutorials and questions which been asked before, but still no good (I'm total beginner in ec2)

I've did the following: lunched Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type.

sudo yum install tomcat8-webapps tomcat8-admin-webapps
sudo yum install tomcat8
sudo service tomcat8 start

I've added this rule to my security group inbound:

HTTP
TCP
80
0.0.0.0/0

but when I try to browse to: Public DNS:8080

I get:

This webpage is not available: ERR_CONNECTION_TIMED_OUT

I expect to see the tomcat welcome page (as I go to localhost:8080) so I could deploy my war file.

what am I missing?

Thanks.

Upvotes: 2

Views: 4329

Answers (3)

To solve this you need to configure load balancer in AWS and set port forwarding to local machine (external port (8080) -> internal port (8080)).

Upvotes: 0

M4ver1k
M4ver1k

Reputation: 1575

If Tomcat itself if running, you need to add a inbound TCP rule for port 8080 in your Security Groups from AWS Console. enter image description here

You may also check if Tomcat is running at port 8080 simply by issuing a

curl localhost:8080

Note: Only open necessary ports for public access because of security reasons.Tomcat GUI Manager also have to be enabled,Do not use the default username/password of tomcat/tomcat. Use a more secure password.

Upvotes: 6

23nikoloz
23nikoloz

Reputation: 70

First check:

$ netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN     
tcp6       0      0 127.0.0.1:8080          :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN   

You need add tomcat parameters (catalina.sh):

JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true "

Upvotes: 3

Related Questions