Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow public connections to local Ruby on Rails Development Server

I am setting up a RoR development environment on a Windows machine. I was wondering how I can set it up so a few friends of mine can have access to the web server and monitor the progress?

It would only be 2 or 3 people connecting at anytime time max.

like image 746
Dan Avatar asked Feb 14 '12 19:02

Dan


2 Answers

The simplest way requires NO additional installations: just add a single option to your rails server (or rails s) command when you start up the server:

rails s --binding=0.0.0.0 

The 0.0.0.0 address means "listen to requests from anywhere." On many systems, the default is 127.0.0.1, which means "listen to requests from localhost only."

(If you don't also specify a -p or --port option, then the port shall be 3000, as usual.)

like image 101
JellicleCat Avatar answered Oct 16 '22 09:10

JellicleCat


You can tell your development server to listen on your publicly accessible interface:

If you're running a server via rails server, you can specify the IP to listen on via -b <ip> or --binding=<ip>. By default, the server listens on 0.0.0.0, that is, only for local connections.

Usage: rails server [mongrel, thin, etc] [options]     -p, --port=port                  Runs Rails on the specified port.                                      Default: 3000     -b, --binding=ip                 Binds Rails to the specified ip.                                      Default: 0.0.0.0 

You can instead find out what your machine's network address is and bind to that address instead, but you will have to forward ports and figure out what your publicly routable IP address is on the Internet; this is outside the bounds of Stack Overflow.

like image 23
meagar Avatar answered Oct 16 '22 10:10

meagar