Lighttpd works fine in development. Production not happening

Hello,

I’ve checked out my rails tree from svn into the location I intend to
run in production mode. However, I am unclear on what exactly needs to
change for it to work in production mode.

Yes I have:
“bin-environment” => (“RAILS_ENV” => “production”)

When I switch to the externally routed IP address instead of
0.0.0.0:3000 and try running:
% ruby scripts/server

The server refuses to launch saying it can’t bind to the port. Huh?

The sounds easy. What have I overlooked?

Thanks,
Doug

Douglass T. wrote:

Hello,

I’ve checked out my rails tree from svn into the location I intend to
run in production mode. However, I am unclear on what exactly needs to
change for it to work in production mode.

Yes I have:
“bin-environment” => (“RAILS_ENV” => “production”)

When I switch to the externally routed IP address instead of
0.0.0.0:3000 and try running:
% ruby scripts/server

The server refuses to launch saying it can’t bind to the port. Huh?

The sounds easy. What have I overlooked?

Thanks,
Doug

You usually need root privileges to bind to ports below 1024. Are you
trying to bind to 80 ? And if so, are you root, or using sudo ?

If it’s not that, is there something already running on the port you’re
trying to use ? (try 'telnet localhost ’ and see if you get a
response)

If it’s not that, is there any kind of firewall type software
restricting use of that port ?

Alan

Alan F. wrote:

Douglass T. wrote:

Hello,

I’ve checked out my rails tree from svn into the location I intend to
run in production mode. However, I am unclear on what exactly needs to
change for it to work in production mode.

Yes I have:
“bin-environment” => (“RAILS_ENV” => “production”)

When I switch to the externally routed IP address instead of
0.0.0.0:3000 and try running:
% ruby scripts/server

The server refuses to launch saying it can’t bind to the port. Huh?

The sounds easy. What have I overlooked?

Thanks,
Doug

You usually need root privileges to bind to ports below 1024. Are you
trying to bind to 80 ? And if so, are you root, or using sudo ?

If it’s not that, is there something already running on the port you’re
trying to use ? (try 'telnet localhost ’ and see if you get a
response)

If it’s not that, is there any kind of firewall type software
restricting use of that port ?

Alan

Alan,

I am running as root. My host machine which is behind the
router/firewall in my home is forwarding the appropriate ports.

For example I can telnet myhost.com 25

Note I have not added:
server.username = “foo_name”
server.groupname = “foo_group”

Shoud I?

I am just using the config file that is automagically created by Rails
when I created my app.

-Doug

Chris T wrote:

Douglass T. wrote:

Yes I have:
Thanks,
restricting use of that port ?
For example I can telnet myhost.com 25
-Doug

You might just check your running processes, just in case your distro
added (and booted up on start) apache, or even lighttpd itself. Caught
me out first time I tried to move from dev to prod

Here is the actual error I’m getting. I am completely stumped on this.
I’ve run Apache for years and never had these kinds of head scratchers:

=> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)
=> Rails application started on http://my-server.com:8080
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
2006-06-19 14:13:01: (network.c.300) can’t bind to port:
theimageengine.com 8080 Cannot assign requested address
Exiting

-Doug

You seem to have another program running on that port.

Douglass T. wrote:

Yes I have:
Thanks,
restricting use of that port ?
For example I can telnet myhost.com 25
-Doug

You might just check your running processes, just in case your distro
added (and booted up on start) apache, or even lighttpd itself. Caught
me out first time I tried to move from dev to prod

Douglass T. wrote:

Nicolai Reuschling wrote:

You seem to have another program running on that port.

I’ve done more digging. No joy yet, but it appears that lighttpd is can
only bind to non routed IP addresses. I cannot associate my external
“live” IP address or domain name.

Anyone seen this before.

I really, really would like to get this sorted soon, so any and all help
MUCH appreciated.

-Doug

Nicolai Reuschling wrote:

You seem to have another program running on that port.

Running ps shows no offending programs, daemons, or whatnot.
Running nmap -sV does not show anything running on the port I want to
use.

Could someone PLEASE post a working lighttpd.conf file for production
mode. Just a plain vanilla config file, no bells and whistles.

Thanks,
Doug

Jeremy E. wrote:

On 6/19/06, Douglass T. [email protected] wrote:

I’ve done more digging. No joy yet, but it appears that lighttpd is can
only bind to non routed IP addresses. I cannot associate my external
“live” IP address or domain name.

Can you post your current lighttpd.conf as well as the output of
ifconfig?

lighttpd.conf is vanilla with port and domain name swapped in. Whatever
Rails generates when I build the scaffold for my app.

ifconfig -a on my suse 10 linux box running behind a router forwarding
ports:
eth1 Link encap:Ethernet HWaddr 00:0C:29:9E:D9:2E
inet addr:192.168.1.111 Bcast:255.255.255.255
Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe9e:d92e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:488297 errors:0 dropped:0 overruns:0 frame:0
TX packets:239084 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:46406002 (44.2 Mb) TX bytes:40158811 (38.2 Mb)
Interrupt:185 Base address:0x1400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:71146 errors:0 dropped:0 overruns:0 frame:0
TX packets:71146 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:44396956 (42.3 Mb) TX bytes:44396956 (42.3 Mb)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

-Doug

On 6/19/06, Douglass T. [email protected] wrote:

I’ve done more digging. No joy yet, but it appears that lighttpd is can
only bind to non routed IP addresses. I cannot associate my external
“live” IP address or domain name.

Can you post your current lighttpd.conf as well as the output of
ifconfig?

This just in,

I grabbed the apache 1.3 tarball, installed it, fired it up and lo and
behold it serves up html just fine on port 80 using my externally
routable domain name. Took me 5 minutes from download to serving html.

Conclusion:
my network infrastructure is just fine. Port 80 is forwarding just fine.

So the ball is squarely in the lighttpd court now. I really need the
collective Rails braintrust on this one folks.

What is going on with rails+lighttpd in production mode people?

-Doug

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs