[英]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) 我已经听了很多以前曾经问过的教程和问题,但是还是不好(我是ec2的初学者)
I've did the following: lunched Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type. 我已执行以下操作:午餐了Amazon Linux AMI 2015.09.1(HVM),SSD卷类型。
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 但是当我尝试浏览到:公共DNS:8080
I get: 我得到:
This webpage is not available: ERR_CONNECTION_TIMED_OUT
该网页不可用: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. 我希望看到tomcat欢迎页面(当我转到localhost:8080时),以便我可以部署war文件。
what am I missing? 我想念什么?
Thanks. 谢谢。
If Tomcat
itself if running, you need to add a inbound TCP rule
for port 8080 in your Security Groups from AWS Console. 如果
Tomcat
本身在运行,则需要从AWS控制台为安全组中的端口8080添加inbound TCP rule
。
You may also check if Tomcat is running at port 8080 simply by issuing a 您还可以通过发出以下命令检查Tomcat是否在端口8080上运行:
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. 注意 :出于安全原因,仅打开必要的端口以供公共访问。还必须启用Tomcat GUI管理器, 请勿使用默认的用户名/密码tomcat / tomcat。 Use a more secure password.
使用更安全的密码。
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): 您需要添加tomcat参数(catalina.sh):
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true "
要解决此问题,您需要在AWS中配置负载均衡器,并将端口转发设置为本地计算机(外部端口(8080)->内部端口(8080))。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.