无法连接到 AWS 中的 rails 服务器
Trouble connecting to rails server in AWS
我组装了一个 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
在同一个实例中,这两个请求 return 成功(rails 版本和 blob of stuff):
curl http://172.31.42.206:3800 <private IP>
curl http://54.86.xxx.xx:3800 <public IP
但是从我不在 EC2 中的计算机上,我可以卷曲端口 80 没问题,但不能卷曲端口 3800,其中 Puma 运行ning。这让我相信我的 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
这不是 AWS 或 rails...。是我愚蠢的办公室防火墙阻止我访问 ec2 中的任意端口。我可以从我的 phone 正常访问该站点。抱歉!
我组装了一个 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
在同一个实例中,这两个请求 return 成功(rails 版本和 blob of stuff):
curl http://172.31.42.206:3800 <private IP>
curl http://54.86.xxx.xx:3800 <public IP
但是从我不在 EC2 中的计算机上,我可以卷曲端口 80 没问题,但不能卷曲端口 3800,其中 Puma 运行ning。这让我相信我的 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
这不是 AWS 或 rails...。是我愚蠢的办公室防火墙阻止我访问 ec2 中的任意端口。我可以从我的 phone 正常访问该站点。抱歉!