PDA

View Full Version : Ruby on Rails web server config




jeremy.king
May 17, 2006, 01:49 PM
In my limited free time, I am trying to get Ruby on Rails up and running on my mini. I was successful getting everything going with one exception. I can't get Rails to listen on my machine's internal network IP address, meaning I cannot access my app from another machine on the same network by using my mini's IP address - http://192.168.1.200:3000/myapp. However, I am able to access it from the mini itself using http://localhost:3000/myapp.

So I am wondering is there is a way I can configure the lighttpd container to listen on 192.168.1.200? From what I have read 0.0.0.0 is supposed to represent all the IPs, but this obviously isn't working for me. I just don't understand which config file I should be playing with and what I should be changing.

Another thing I haven't tried is poking a hole in my firewall for port 3000, but I didn't think this was necessary as I run and access Tomcat on 8080 without a hole -- sounds funny :)

Heres what my server script displays.

miniweb:~/testruby jeremy$ script/server
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> Rails application started on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)


Thanks for any help - I'll continue the trial by error method...



Glenc
May 17, 2006, 01:58 PM
I've set up the same thing on a linux box and all that was needed for ip access was the ip / server name and the port. I can't imagine why it would be different for mac.

Sounds like a firewall thing for the port. 8080 is a bit higher so double check your firewall isn't filtering 3000. I read somewhere where you can configure it for port 80 but haven't done it yet so don't know what other services it might be competing with (on the mac) if I go that route.

jeremy.king
May 17, 2006, 02:02 PM
I've set up the same thing on a linux box and all that was needed for ip access was the ip / server name and the port. I can't imagine why it would be different for mac.

Sounds like a firewall thing for the port. 8080 is a bit higher so double check your firewall isn't filtering 3000. I read somewhere where you can configure it for port 80 but haven't done it yet so don't know what other services might be competing competing with (on the mac) if I go that route.

I too thought the same thing...

Trying server.bind in my lighttpd.conf gave me probs too...hrm. :(

I'll play with my firewall, I guess...


=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> Rails application started on http://192.168.1.200:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
2006-05-17 14:01:01: (network.c.300) can't bind to port: 192.168.1.200 3000 Can't assign requested address
Exiting

white89gt
May 17, 2006, 02:07 PM
I've recently been writing a web app for work using Ruby on Rails, but it has been on my PC laptop and not on my iMac. I've given some thought to loading it up on my iMac, but haven't gone through the process. I can say that I don't have any trouble accessing the web server on my laptop from any other computer either at work or home. Chances are you've got a firewall issue. I know that the Windows XP SP2 firewall had a fit as soon as I fired up the web server....that's why it is completely disabled now. There is a way to configure it to listen to port 80, but I don't know how since I've only been using the webrick server that's packaged with ROR. If you did that and your firewall would allow it, you could attatch to the computer using its IP address only.

Glenc
May 17, 2006, 02:07 PM
I found this...looks like it might do the trick

http://www.digitalmediaminute.com/howto/fc4rails/#confLighttpd

also::

run script/server to make the config/lighttpd.conf - then edit it, change .port from 3000 to 80, make sure your apache (or other port 80 service) is off, then run script/server as root.

the config should be in: [RAILS_ROOT]/config/lighttpd.conf

jeremy.king
May 17, 2006, 02:16 PM
run script/server to make the config/lighttpd.conf - then edit it, change .port from 3000 to 80, make sure your apache (or other port 80 service) is off, then run script/server as root.



Good point. I didn't think of trying port 80 (brainfart) - a port I know is allowed...Can't wait to get home, now...:)

jeremy.king
May 18, 2006, 12:12 PM
It was definitely a firewall issue. In fact, OS X was blocking 80 (apache), 8080 (tomcat) and 3000 (RoR)...Things must have changed with some of the security patches, as I have never had to add firewall entries in the past for any of those services... I even hosted my own site for a few months without any firewall config...

Go figure...

Thanks for your help guys! :)