简体   繁体   中英

Not able to run ruby on rails on ubuntu

I have installed ruby on rails using the below tutorial https://gorails.com/setup/ubuntu/14.10 .I completed all the steps mentioned as per the tutorial and I could even create a rails app and run it using rails server .

When I used rails server , it showed me

ubuntu@ip-192-30-0-97:~/myapp$ rails server
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-02-01 09:45:51] INFO  WEBrick 1.3.1
[2015-02-01 09:45:51] INFO  ruby 2.1.5 (2014-11-13) [x86_64-linux]
[2015-02-01 09:45:51] INFO  WEBrick::HTTPServer#start: pid=11899 port=3000

But when I navigate to my IP (Elastic IP pointing to my instance running Ubuntu 14.04),Im just getting a page "Website not available" .I could get this working on my local computer,when I navigated to the localhost IP the rails default page opened up,however here Im not able to get this working.

I am new to RoR and ubuntu,please help on this.


As of rails 4.2, rails s by default only binds to the localhost interface. To bind to other interfaces use the - b option, for example

rails s -b 0.0.0.0

restores the behaviour of earlier rails versions. You'll still need to configure security group rules and any firewall running on the instance to allow incoming connections.

Usually one wouldn't use webrick for a production deployment though

The webrick server seems to be running properly. You need to go to:

http://ipaddress:3000

And you should see the rails default page.

You can also try running webrick on port 80 like this:

rails s -p 80

And then simply accessing it with http://ipaddress

This is considering port 3000 or 80 are open on your server. If you are using Amazon EC2, check out their documentation:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html

Here is the easiest way to install rvm, rails and ruby in one command only. Run

\\curl -sSL https://get.rvm.io | bash -s stable --rails

in terminal. It's going to reject you first time, you have to import the key, just c/p the line above, it actually says you to do that. Then run the curl command again and voila, you have working rails environment. Hope this helps.

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