Question

I have a Rails app setup to start on a Vagrant Box. I do:

vagrant up
vagrant ssh
cd /vagrant
rails server &

At this point everything is fine - I have the app up and running and all is well. I would like to go back to my dev machine while having the box running so i just logout Ctrl+D. At this point, when I try to access the app. I get a 200 OK response but a blank page. When I do vagrant ssh and get the local page, I get the same result: 200 OK 0-byte response.

It seems that logging out is deactivating the Webrick server, while also not killing it (the process is working and can be killed).

I would like to stress that the vagrant setup is ok - before the log-out everything is fine. I have port forwarding setup and everything.

The version are:

  • ruby 2.0.0dev (2013-02-08 trunk 39161)
  • Rails 4.0.0
Was it helpful?

Solution

You should run rails server -d instead of rails server &

OTHER TIPS

I the interest of being complete I just want to say that running the server via nohup will also get the desired result, as in:

vagrant up
vagrant ssh
cd /vagrant
nohup rails server

But you should probably stick to the accepted answer as it's a more standard way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top