[英]After installing rails, how to run rails server on amazon ec2 instance?
I installed rails on an instance on amazon AMI. 我在亚马逊AMI上的一个实例上安装了rails。 I installed all the dependencies for rails. 我安装了rails的所有依赖项。 I even copied the code through scp. 我甚至通过scp复制了代码。 When i ssh to the instance i ran 当我ssh到实例我跑
rails s
The server is running. 服务器正在运行。 How can I view it from the browser? 如何从浏览器中查看? from the Public DNS??? 来自公共DNS ???
In summary, sure that your security group have a rule for TCP 3000.Then, you can use the Public DNS: 总之,确保您的安全组具有TCP 3000规则。然后,您可以使用公共DNS:
rails server -b ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com -p 3000 rails server -b ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com -p 3000
And access to: ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com:3000 并访问:ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com:3000
This works for me. 这适合我。
Your amazon ec2 instance has a public ip address and domain name, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html 您的amazon ec2实例有一个公共IP地址和域名,请参阅http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
use this domain name as the URL in your browser. 使用此域名作为浏览器中的URL。
You will also have to set inbound traffic / port connections in the security group of the instance. 您还必须在实例的安全组中设置入站流量/端口连接。
A word of warning: with "rails s" you are starting webrick, a server that is only meant to be used in development. 一句警告:使用“rails s”,您将开始webrick,这是一个仅用于开发的服务器。 You probably should use a production server like apache + mod_passenger. 您可能应该使用像apache + mod_passenger这样的生产服务器。
For more advanced usage of ec2 and ruby on rails see 有关ec2和ruby在轨道上的更高级用法,请参阅
http://railscasts.com/episodes/347-rubber-and-amazon-ec2?view=asciicast http://railscasts.com/episodes/347-rubber-and-amazon-ec2?view=asciicast
从rails应用程序移动到文件夹并键入rails s -b 0.0.0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.