如何访问安装在AWS EC2上的nodejs应用程序

时间:2021-01-15 22:44:40

I have AWS EC2 with Ubuntu instance. I successfully setup ssh access and I am able to login via ssh console. I installed NodeJS and one simple NodeJS application.
Successfully start it by node server.js and when executing curl http://localhost:8080 I can confirm application is up and running. My only issue is that I am not able to access it using provided public IP by AWS.

我有AWS EC2和Ubuntu实例。我成功地设置了ssh访问,并且能够通过ssh控制台登录。我安装了NodeJS和一个简单的NodeJS应用程序。通过节点服务器成功启动。执行curl http://localhost:8080时,我可以确认应用程序已经启动并正在运行。我唯一的问题是我不能使用AWS提供的公共IP访问它。

I can see my public IP from AWS console, and I thought it should be enough to type:
http://aws-public-ip:8080 and it should load the application. It seams I am wrong since I don't obtain access to my app.

我可以从AWS控制台看到我的公共IP,我认为输入:http://aws-public-ip:8080就足够了,它应该会加载应用程序。因为我无法访问我的应用程序,所以我错了。

Any hints would be appreciated.

如有任何提示,我们将不胜感激。

1 个解决方案

#1


0  

Actually I found the answer by myself - I had to edit security group rule and just add rule for corresponding port. By default security group created when you create your instance has only one incoming rule for port 22.

实际上我自己找到了答案——我必须编辑安全组规则,并为相应的端口添加规则。在创建实例时创建的默认安全组只对端口22有一个传入规则。

#1


0  

Actually I found the answer by myself - I had to edit security group rule and just add rule for corresponding port. By default security group created when you create your instance has only one incoming rule for port 22.

实际上我自己找到了答案——我必须编辑安全组规则,并为相应的端口添加规则。在创建实例时创建的默认安全组只对端口22有一个传入规则。