0

I I am running rails using vagrant VM and when i launch server with

`rails s`

It works fine and shows me that i am running server fine:

=> Booting WEBrick

=> Rails 4.2.3 application starting in development on http://localhost:3000

=> Run `rails server -h` for more startup options

=> Ctrl-C to shutdown server

[2015-08-22 17:46:42] INFO  WEBrick 1.3.1

[2015-08-22 17:46:42] INFO  ruby 2.2.1 (2015-02-26) [i686-linux]

[2015-08-22 17:46:42] INFO  WEBrick::HTTPServer#start: pid=3660 port=3000

♥[2015-08-22 17:48:09] INFO  going to shutdown ...


[2015-08-22 17:48:09] INFO  WEBrick::HTTPServer#start done.

BUt when i try to access it using http://localhost:3000 it doesn't load.I started a few weeks ago and it was working fine but then i tried to uninstall and reinstall(using same resources and configurations)because i had some problems and since then it's not working.I have tried running it on different port with:

rails s -p 3001

still no respond.And i also tried making more new apps and running them just incase i am messing up some default configurations and still not working.I am now using cloud9 IDE but i read somewhere that when seeking professional career IDE's are discouraged.Don't know what's true and what to do.

Arvind
  • 2,671
  • 1
  • 18
  • 32
enemy123
  • 43
  • 9
  • Let me get this straight are you launching the server on the cloud9 IDE and expecting it ? i can't get this , on the machine that you are talking about enter the following command `netstat -tulpn | grep :3000` to see if there's any process using that port before and after you start the server – Kiloreux Aug 22 '15 at 19:40
  • Just for clarification, are you trying to access it from the VM or from the host system? Because if it's the latter you will either need to forward the port from VM to host, or access the webserver with the VMs address (and you need to make sure webrick doesn't bind to localhost only). – Nils Landt Aug 22 '15 at 19:42
  • I am really sorry that last part about IDE was confusing.What i meant was that since i cannot run it in my computer,i have to now use cloud9 IDE for rails.However i read once on a forum that IDE's are not really supported at professional levels of development.So is it ok if i keep developing in IDE or should i solve this issue?Again i am really sorry if i can't clear things it's my very first time here. – enemy123 Aug 22 '15 at 20:16
  • Try running `rails s -b 0.0.0.0` and see if it is ok. – Ruby Racer Aug 22 '15 at 22:18
  • Thank you that worked.Can you suggest what possibly the problem might be? – enemy123 Aug 25 '15 at 07:16

1 Answers1

0

Does your Vagrantfile have the following line in it?
config.vm.network :forwarded_port, guest: 3000, host: 3000 # rails

You may have started the port on your VM but given your host computer no way of getting to that port.

(Alternatively, to prove this you could use lynx in the VM to see if you could connect to your site)

[Edit: Assuming you're running Vagrant on your own machine: slightly confused where the Cloud9 bit is coming in, unless you're in cloud9 now and want to migrate off, to your own machine running Vagrant...)]

RyanWilcox
  • 13,890
  • 1
  • 36
  • 60