# Problem with lighttpd

**URL:** <https://www.ruby-forum.com/t/problem-with-lighttpd/63528>\
**Category:** Rails\
**Created:** [June 15, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528 "2006-06-15T22:33:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 15, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/1 "2006-06-15T22:33:09Z")

</div>

I have a problem with lighttpd on OSX.

Everything builds fine (and webrick runs just fine) but lighttpd barfs:

edward-kenworthys-computer:~/Development/Ruby/pricematic/trunk edward$  
script/server  
=\> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)  
=\> Rails application started on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server (see config/lighttpd.conf for options)  
/Users/edward/Development/Ruby/pricematic/trunk/public/…/config/boot.rb:15:in  
`require': No such file to load -- rubygems (LoadError) from /Users/edward/Development/Ruby/pricematic/trunk/public/../config/boot.rb:15 from /Users/edward/Development/Ruby/pricematic/trunk/public/../config/environment.rb:8:in `require’  
from  
/Users/edward/Development/Ruby/pricematic/trunk/public/…/config/environment.rb:8  
from  
/Users/edward/Development/Ruby/pricematic/trunk/public/dispatch.fcgi:21:in  
`require’  
from  
/Users/edward/Development/Ruby/pricematic/trunk/public/dispatch.fcgi:21  
2006-06-15 21:02:59: (mod\_fastcgi.c.1048) the fastcgi-backend  
/Users/edward/Development/Ruby/pricematic/trunk/public/dispatch.fcgi  
failed to start:  
2006-06-15 21:02:59: (mod\_fastcgi.c.1052) child exited with status 1  
/Users/edward/Development/Ruby/pricematic/trunk/public/dispatch.fcgi  
2006-06-15 21:02:59: (mod\_fastcgi.c.1055) if you try do run PHP as  
FastCGI backend make sure you use the FastCGI enabled version.  
You can find out if it is the right one by executing ‘php -v’ and it  
should display ‘(cgi-fcgi)’ in the output, NOT (cgi) NOR (cli)  
For more information check  
[http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program](http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program)  
2006-06-15 21:02:59: (mod\_fastcgi.c.1060) If this is PHP on Gentoo add  
fastcgi to the USE flags  
2006-06-15 21:02:59: (mod\_fastcgi.c.1356) [ERROR]: spawning fcgi failed.  
2006-06-15 21:02:59: (server.c.834) Configuration of plugins failed.  
Going down.  
Exiting  
edward-kenworthys-computer:~/Development/Ruby/pricematic/trunk edward$

Anyone have any ideas?

Edward

---

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 16, 2006, 7:10am UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/2 "2006-06-16T07:10:34Z")

</div>

looks like you need to install/update rubygems or there’s something  
wrong with your PATH,

[http://rubyforge.org/projects/rubygems](http://rubyforge.org/projects/rubygems)

/r/r

On 6/15/06, Edward K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /Users/edward/Development/Ruby/pricematic/trunk/public/…/config/boot.rb:15:in  
> `require’  
> should display ‘(cgi-fcgi)’ in the output, NOT (cgi) NOR (cli)  
> Anyone have any ideas?
> 
> Edward
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Rodney  
[http://www.pinupgeek.com](http://www.pinupgeek.com)  
[http://www.dutchrailers.org](http://www.dutchrailers.org)

---

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 16, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/3 "2006-06-16T20:36:22Z")

</div>

Nope rubygems works fine and require ‘rubygems’ in irb works fine as  
well.

---

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 17, 2006, 12:20pm UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/4 "2006-06-17T12:20:03Z")

</div>

Could you post the config/lighttpd.conf and the public/dispatch.fcgi  
to help us help you. 🙂

On 6/16/06, Edward K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Nope rubygems works fine and require ‘rubygems’ in irb works fine as  
> well.
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 18, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/5 "2006-06-18T15:53:38Z")

</div>

JÃ³n BorgÃ¾Ã³rsson wrote:

> Could you post the config/lighttpd.conf and the public/dispatch.fcgi  
> to help us help you. 🙂

Of course. (I haven’t edited either). This is lighttpd.conf

# Default configuration file for the lighttpd web server

# Start using ./script/server lighttpd

server.bind = “0.0.0.0”  
server.port = 3000

server.modules = ( “mod\_rewrite”, “mod\_accesslog”,  
“mod\_fastcgi”, “mod\_compress”, “mod\_expire” )

server.error-handler-404 = “/dispatch.fcgi”  
server.document-root = CWD + “/public/”

server.errorlog = CWD + “/log/lighttpd.error.log”  
accesslog.filename = CWD + “/log/lighttpd.access.log”

url.rewrite = ( “^/$” =\> “index.html”, “^([^.]+)$” =\>  
“$1.html” )

compress.filetype = ( “text/plain”, “text/html”, “text/css”,  
“text/javascript” )  
compress.cache-dir = CWD + “/tmp/cache”

expire.url = ( “/favicon.ico” =\> “access 3 days”,  
“/images/” =\> “access 3 days”,  
“/stylesheets/” =\> “access 3 days”,  
“/javascripts/” =\> “access 3 days” )

# Change \*-procs to 2 if you need to use Upload Progress or other tasks

that

# _need_ to execute a second request while the first is still pending.

fastcgi.server = ( “.fcgi” =\> ( “localhost” =\> (  
“min-procs” =\> 1,  
“max-procs” =\> 1,  
“socket” =\> CWD + “/tmp/sockets/fcgi.socket”,  
“bin-path” =\> CWD + “/public/dispatch.fcgi”,  
“bin-environment” =\> ( “RAILS\_ENV” =\> “development” )  
) ) )

mimetype.assign = (  
“.css” =\> “text/css”,  
“.gif” =\> “image/gif”,  
“.htm” =\> “text/html”,  
“.html” =\> “text/html”,  
“.jpeg” =\> “image/jpeg”,  
“.jpg” =\> “image/jpeg”,  
“.js” =\> “text/javascript”,  
“.png” =\> “image/png”,  
“.swf” =\> “application/x-shockwave-flash”,  
“.txt” =\> “text/plain”  
)

# Making sure file uploads above 64k always work when using IE or Safari

# For more information, see [http://trac.lighttpd.net/trac/ticket/360](http://trac.lighttpd.net/trac/ticket/360)

$HTTP[“useragent”] =~ “^(._MSIE._)|(._AppleWebKit._)$” {  
server.max-keep-alive-requests = 0  
}

And this is dispatch.fcgi

#!/usr/bin/ruby

# 

# You may specify the path to the FastCGI crash log (a log of unhandled

# exceptions which forced the FastCGI instance to exit, great for

debugging)

# and the number of requests to process before running garbage

collection.

# 

# By default, the FastCGI crash log is RAILS\_ROOT/log/fastcgi.crash.log

# and the GC period is nil (turned off). A reasonable number of

requests

# could range from 10-100 depending on the memory footprint of your app.

# 

# Example:

# # Default log path, normal GC behavior.

# RailsFCGIHandler.process!

# 

# # Default log path, 50 requests between GC.

# RailsFCGIHandler.process! nil, 50

# 

# # Custom log path, normal GC behavior.

# RailsFCGIHandler.process! ‘/var/log/myapp\_fcgi\_crash.log’

# 

require File.dirname( **FILE** ) + “/…/config/environment”  
require ‘fcgi\_handler’

RailsFCGIHandler.process!

TIA for your help.

---

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 19, 2006, 6:18am UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/6 "2006-06-19T06:18:25Z")

</div>

In the terminal. Write  
which ruby

And that should give you the Ruby location. Use that in the dirst line  
of your dispatch.fcgi

On 6/18/06, Edward K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> server.bind = “0.0.0.0”
> 
> ```
> "/javascripts/" => "access 3 days" )
> 
> ```
> 
> “bin-environment” =\> ( “RAILS\_ENV” =\> “development” )  
> “.png” =\> “image/png”,  
> And this is dispatch.fcgi
> 
> # and the GC period is nil (turned off). A reasonable number of
> 
> # # Custom log path, normal GC behavior.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![countbrass](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@countbrass](https://www.ruby-forum.com/u/countbrass)\
**Post date:** [June 19, 2006, 9:58am UTC](https://www.ruby-forum.com/t/problem-with-lighttpd/63528/7 "2006-06-19T09:58:50Z")

</div>

JÃ³n BorgÃ¾Ã³rsson wrote:

> In the terminal. Write  
> which ruby
> 
> And that should give you the Ruby location. Use that in the dirst line  
> of your dispatch.fcgi

Thank you! That’s fixed it.
