2

I haven't been able to find previous answered questions on this, unless I'm missing one. Anyways, when I try starting a rails server:

vagrant [accounts]> rails s
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-06-06 02:38:50] INFO  WEBrick 1.3.1
[2015-06-06 02:38:50] INFO  ruby 2.2.2 (2015-04-13) [i686-linux]
[2015-06-06 02:38:50] INFO  WEBrick::HTTPServer#start: pid=23016 port=3000

But that's all I ever get, no error messages or anything. Of course localhost:3000 produces 'no data received'

As you can see I'm using Ruby 2.2.2 and Rails 4.2.1 I'm in the root for the app, have tried updating bin. I'm using the sqlite3 gem, I've created and migrated the db. I am convinced it has nothing to do with this particular rails app because I've gone back and tried to open old projects that are now having the same problem. Recently I've upgraded from Ubuntu 12.04 to 14.04 on my vm. I've also recently upgraded ruby (I manage with rvm) and rails. I've also recently put some stuff on heroku. All of this has messed with $PATH (I'm not sure if this is related, I'm pretty new to all this stuff). Just wanted to detail everything I could think of that might have an effect.

Thanks!

dcotes
  • 25
  • 4
  • If you're running Rails on a VM, you might have to review your network routing. It might be that 'localhost' is trying to reach the main OS rather than the VM... Think of it like the same issue (although it could be reversed) caused by running the browser on the main OS and trying to connect to the VM - you would need the VM's correct address. Let me know if this helps. – Myst Jun 06 '15 at 03:14

1 Answers1

3

I ran into the following problem recently, could this be your issue also?

If so try

rails s -b 0.0.0.0

3.3 Default Host for rails server Due to a change in Rack, rails server now listens on localhost instead of 0.0.0.0 by default. This should have minimal impact on the standard development workflow as both http://127.0.0.1:3000 and http://localhost:3000 will continue to work as before on your own machine.

However, with this change you will no longer be able to access the Rails server from a different machine, for example if your development environment is in a virtual machine and you would like to access it from the host machine. In such cases, please start the server with rails server -b 0.0.0.0 to restore the old behavior.

If you do this, be sure to configure your firewall properly such that only trusted machines on your network can access your development server.

See the release notes here for the details.

nPn
  • 16,254
  • 9
  • 35
  • 58
  • thanks!! I tried to up vote but I don't have enough street cred here yet – dcotes Jun 06 '15 at 18:26
  • Sort of, I can get it running in rails but recently just tried the a ruby server to host an html file and have run into the same problem. Maybe I need to figure out the network routing between my VM and OS. Not sure how to go about that though – dcotes Jun 25 '15 at 21:53