无法连接到AWS中的rails服务器

时间:2016-10-18 21:15:53

标签: ruby-on-rails amazon-ec2 puma

我整理了一个rails 5应用程序,并尝试从AWS ec2实例运行它。我已经设置了安全组,但无法访问我选择的特殊端口。可能有什么不对?

安全组设置:

Ports   Protocol    Source  rails-dev-and-ssh 
80  tcp 72.21.xxx.0/24  ✔
22  tcp 72.21.xxx.0/24  ✔
3800    tcp 0.0.0.0/0   ✔

Puma服务器已启动:

[ec2-user@ip-172-31-42-206 Viewer]$ rails server -p 3800 -b 172.31.42.206
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://172.31.42.206:3800
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://172.31.42.206:3800
Use Ctrl-C to stop

从同一个实例中,这两个请求都返回成功(rails版本和blob的东西):

curl http://172.31.42.206:3800 <private IP>
curl http://54.86.xxx.xx:3800 <public IP

但是我的计算机不在EC2中,我可以卷起端口80没有问题,但不是端口3800,Puma正在运行。这让我相信我的AWS VPC配置没问题,但是Puma绑定的IP有问题。我也试过绑定到0.0.0.0。

$ curl http://54.86.xxx.xx/  <the public ip, port 80, succeeds>
hi raj var www html

$ curl http://54.86.xxx.xx:3800
curl: (7) Failed to connect to 54.86.xxx.xx port 3800: Operation timed out

1 个答案:

答案 0 :(得分:0)

它不是AWS或rails ....它是我愚蠢的办公室防火墙,阻止我访问ec2中的任意端口。我可以通过手机访问网站。遗憾!

相关问题