简体   繁体   中英

After installing rails, how to run rails server on amazon ec2 instance?

I installed rails on an instance on amazon AMI. I installed all the dependencies for rails. I even copied the code through scp. When i ssh to the instance i ran

rails s

The server is running. How can I view it from the browser? from the Public DNS???

In summary, sure that your security group have a rule for TCP 3000.Then, you can use the Public DNS:

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

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

use this domain name as the URL in your browser.

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. You probably should use a production server like apache + mod_passenger.

For more advanced usage of ec2 and ruby on rails see

http://railscasts.com/episodes/347-rubber-and-amazon-ec2?view=asciicast

从rails应用程序移动到文件夹并键入rails s -b 0.0.0.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM