【问题标题】:Trouble connecting to rails server in AWS无法连接到 AWS 中的 Rails 服务器
【发布时间】:2017-02-28 07:33:38
【问题描述】:

我组装了一个 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 of stuff):

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

但是从我不在 EC2 中的计算机上,我可以卷曲端口 80 没有问题,但不能卷曲运行 Puma 的端口 3800。这让我相信我的 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

【问题讨论】:

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


    【解决方案1】:

    这不是 AWS 或 rails.... 这是我愚蠢的办公室防火墙阻止我访问 ec2 中的任意端口。我可以通过手机正常访问该网站。对不起!

    【讨论】:

      猜你喜欢
      • 2019-06-15
      • 2013-11-20
      • 2017-07-17
      • 2021-07-16
      • 2014-02-25
      • 2012-07-06
      • 2018-09-27
      • 2017-06-12
      • 1970-01-01
      相关资源
      最近更新 更多