Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Rails Development Server From A Different Computer

I'm using webrick to develop my rails app on Mac OS X Lion. I'm trying to access the site from another computer (for testing). The internal IP of my computer is 10.1.10.100.

Accessing 10.1.10.100 displays the page served by the apache server running on my computer.

Accessing 10.1.10.100:3000 times out, both from my computer and from another computer on the same network. I can ping 10.1.10.100. From my computer, loaclhost:3000 displays the app.

Is there are firewall I need to open up on Mac OS X or some other setting that needs to be applied?

Thanks

like image 270
Tyler DeWitt Avatar asked Apr 09 '12 19:04

Tyler DeWitt


People also ask

How do I run a Rails server on Windows?

Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .

Which server is used by Rails?

The Ruby standard library comes with a default web server named WEBrick. As this library is installed on every machine that has Ruby, most frameworks such as Rails and Rack use WEBrick as a default development web server.

Is Ruby on Rails a Web server?

Ruby on Rails also includes its own built-in web server, WEBrick. WEBrick is for development use and is not recommended for production.

What happens when we run Rails server?

One of the things rails server does is that it loads all the dependencies/gems required by your Rails app, or at least sets them up to be auto-loaded later when they are needed. This is sometimes called "booting" or loading the "Rails environment".


1 Answers

While starting the webrick server specify the IP on which your rails application will run (10.1.10.100 in your case) using -b option, it binds Rails to the specified IP.

rails server -b 10.1.10.100 -p 3000 
like image 95
Kumar Akarsh Avatar answered Sep 17 '22 21:09

Kumar Akarsh