# Broken config/lighttpd.conf? (in EdgeRails)

**URL:** <https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526>\
**Category:** Rails\
**Created:** [March 21, 2006, 8:46pm UTC](https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526 "2006-03-21T20:46:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_T\_Bosse\_II](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@Peter\_T\_Bosse\_II](https://www.ruby-forum.com/u/Peter_T_Bosse_II)\
**Post date:** [March 21, 2006, 8:46pm UTC](https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526/1 "2006-03-21T20:46:27Z")

</div>

I’m using Mac OS X, I installed Ruby/Rails/lighttpd/etc via the  
instructions from hivelogic. I think I’ve found a bug with  
EdgeRails, but I’m not sure how to submit it (and maybe I’m doing  
something wrong and someone can just point me in the right  
direction). Anyway I thought I’d report it just in case it is a bug.

I’ve downloaded the EdgeRails tree (revision 4007 using `/usr/local/ bin/svn co http://dev.rubyonrails.org/svn/rails/trunk rails`) and  
built a new rails app (using `/usr/local/bin/ruby rails/railties/bin/ rails ~/Sites/test2`)

I then cd to the test2 directory, and `rake freeze_edge` (I also have  
GemRails installed which I can’t change yet). When I try to start  
the lighty server (using start/server) it tries to copy lighttpd.conf  
from my vendor directory (as it should). Unfortunately, `rake freeze_edge` doesn’t put “rails/railties/configs/lighttpd.conf” into  
my vendor directory. So script/server barfs:

—%\<—

=\> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)  
=\> config/lighttpd.conf not found, copying from /Users/ptb/Sites/  
Rails/test2/vendor/rails/railties/configs/lighttpd.conf  
/usr/local/lib/ruby/1.8/fileutils.rb:1182:in `stat': No such file or directory - /Users/ptb/Sites/Rails/test2/vendor/rails/railties/ configs/lighttpd.conf (Errno::ENOENT) from /usr/local/lib/ruby/1.8/fileutils.rb:1182:in `lstat’  
from /usr/local/lib/ruby/1.8/fileutils.rb:1160:in `stat' from /usr/local/lib/ruby/1.8/fileutils.rb:1242:in `copy\_file’  
from /usr/local/lib/ruby/1.8/fileutils.rb:459:in `copy_file' from /usr/local/lib/ruby/1.8/fileutils.rb:383:in `cp’  
from /usr/local/lib/ruby/1.8/fileutils.rb:1377:in  
`fu_each_src_dest' from /usr/local/lib/ruby/1.8/fileutils.rb:1393:in `fu\_each\_src\_dest0’  
from /usr/local/lib/ruby/1.8/fileutils.rb:1375:in  
`fu_each_src_dest' from /usr/local/lib/ruby/1.8/fileutils.rb:382:in `cp’  
from ./script/…/config/…/vendor/rails/railties/lib/  
commands/servers/lighttpd.rb:40  
from /usr/local/lib/ruby/site\_ruby/1.8/rubygems/  
custom\_require.rb:21:in `require' from ./script/../config/../vendor/rails/activesupport/lib/ active_support/dependencies.rb:149:in `require’  
from ./script/…/config/…/vendor/rails/railties/lib/  
commands/server.rb:34  
from script/server:3

—%\<—

Unfazed, I tried copying the entire rails tree directly into my  
vendor directory (`/usr/local/bin/svn co http://dev.rubyonrails.org/ svn/rails/trunk vendor/rails`). That should fix the problem of the  
missing lighttpd.conf file. Well it does, but it doesn’t replace  
“CWD” in lighttpd.conf with the current directory, so even though  
lighttpd.conf has been copied, it doesn’t point to the correct  
directory.

—%\<—

=\> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)  
=\> config/lighttpd.conf not found, copying from /Users/ptb/Sites/  
Rails/test/vendor/rails/railties/configs/lighttpd.conf  
=\> 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)  
Undefined config variable: var.CWD  
2006-03-21 11:25:28: (configfile.c.800) source: config/lighttpd.conf  
line: 8 pos: 43 parser failed somehow near here: +  
Exiting

—%\<—

What I’ve been doing is opening the file with vi then doing search  
and replace with CWD with the correct path, but that’s tedious and  
not the way it should be. I think it’s script/server that should do  
the substitutions after it copies the file, but it’s currently not  
doing that. What do you think, bug?

- Peter

---

<div class="post-metadata">

**Author:** ![Peter\_T\_Bosse\_II](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@Peter\_T\_Bosse\_II](https://www.ruby-forum.com/u/Peter_T_Bosse_II)\
**Post date:** [March 22, 2006, 6:37pm UTC](https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526/2 "2006-03-22T18:37:46Z")

</div>

Hi Peter,

I had the same problem. Here’s my simple test, a description of the  
problem, and what I did to fix it. There may be a reason why the  
configs dir is not checked out but I don’t know why that is.

I have rails 1.0 installed. After updating rake I tried the following:

rails editor  
cd editor  
rake freeze\_edge  
script/server

which produced an error when it couldn’t find the file:

vendor/rails/railties/configs/lighttpd.conf

to copy into config/lighttpd.conf

Problem:

The freeze\_edge task in framework.rake only checks out the lib  
directories in each framework but  
vendor/rails/railties/lib/commands/servers/lighttpd.rb is looking for  
vendor/rails/railties/configs/lighttpd.conf.

I patched my Rails 1.0 rake freeze\_edge task  
(rails-1.0.0/lib/tasks/framework.rake):

for framework in %w( railties actionpack activerecord actionmailer  
activesupport actionwebservice )  
mkdir\_p “vendor/rails/#{framework}”  
system “svn export  
[http://dev.rubyonrails.org/svn/rails/trunk/#{framework}/lib](http://dev.rubyonrails.org/svn/rails/trunk/#%7Bframework%7D/lib)  
vendor/rails/#{framework}/lib #{revision\_switch}”  
end  
end

By inserting the following line after line 46:

for framework in %w( railties actionpack activerecord actionmailer  
activesupport actionwebservice )  
mkdir\_p “vendor/rails/#{framework}”  
system “svn export  
[http://dev.rubyonrails.org/svn/rails/trunk/#{framework}/lib](http://dev.rubyonrails.org/svn/rails/trunk/#%7Bframework%7D/lib)  
vendor/rails/#{framework}/lib #{revision\_switch}”  
end  
system “svn export  
[http://dev.rubyonrails.org/svn/rails/trunk/railties/configs](http://dev.rubyonrails.org/svn/rails/trunk/railties/configs)  
vendor/rails/railties/configs #{revision\_switch}”  
end

After rm -rf vendor/rails/ and rake freeze\_edge my script/server  
command worked.

---

<div class="post-metadata">

**Author:** ![Peter\_T\_Bosse\_II](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@Peter\_T\_Bosse\_II](https://www.ruby-forum.com/u/Peter_T_Bosse_II)\
**Post date:** [March 22, 2006, 9:51pm UTC](https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526/3 "2006-03-22T21:51:37Z")

</div>

So, `rake freeze_edge` runs from rails-1.0.0 and not vendor/rails?

Is that what everyone should expect is the correct behavior for  
rake? I would have thought that rake would use vendor/rails if it  
existed, and gemrails only if vendor/rails wasn’t available (in which  
case [http://dev.rubyonrails.org/ticket/4047](http://dev.rubyonrails.org/ticket/4047) would have fixed this  
problem).

- Peter

---

<div class="post-metadata">

**Author:** ![Peter\_T\_Bosse\_II](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@Peter\_T\_Bosse\_II](https://www.ruby-forum.com/u/Peter_T_Bosse_II)\
**Post date:** [March 22, 2006, 10:47pm UTC](https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526/4 "2006-03-22T22:47:24Z")

</div>

Undefined config variable: var.CWD  
means your (and my) lighttpd doesn’t support mod\_cml and I guess edge  
rails assumes you have it.  
I’m on Mac OS X and I haven’t found an easy way to compile lighty with  
mod\_cml yet. The lighttpd +cml darwinport is broken, I think, because  
the lua port doesn’t generate a pkgconfig file. I’d file a bug if I  
had any idea who’s responsibility it is 🙂  
I’d love to hear a non-darwinports way of installing lighty with  
mod\_cml (on OSX x86).

thanks,  
-Sam

---

<div class="post-metadata">

**Author:** ![Peter\_T\_Bosse\_II](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/278dde/32.png) [@Peter\_T\_Bosse\_II](https://www.ruby-forum.com/u/Peter_T_Bosse_II)\
**Post date:** [March 23, 2006, 12:42am UTC](https://www.ruby-forum.com/t/broken-config-lighttpd-conf-in-edgerails/55526/5 "2006-03-23T00:42:19Z")

</div>

\*\*\* Rails 1.1 will require lighttpd 1.4.11 (if you’re using lighttpd)

* * *

* * *

I submitted a ticket on this issue: [http://dev.rubyonrails.org/ticket/](http://dev.rubyonrails.org/ticket/)  
4344 and DHH said that “Yes, Rails 1.1 will assume that you have  
1.4.11 or above. You’re still free to use 1.4.8, but it’ll require  
that you alter your lighttpd.conf accordingly.” (See the ticket for  
a workaround.)

I’ve built lighttpd 1.4.11 on Mac OS X 10.4.5 using the instructions  
from hivelogic (1) (changing the version number obviously) and “CWD”  
is built into 1.4.11. Everyone will need to upgrade to 1.4.11 if  
they want to run Rails 1.1 apps.

> > > So, `rake freeze_edge` runs from rails-1.0.0 and not vendor/rails?

This is my statement, so I’ll give myself a big “DUH”. `rake freeze_edge` copies the EdgeRails trunk _into_ vendor/rails so  
obviously rake is going to use “rails-1.0.0/lib/tasks/framework.rake”  
for it’s configuration (vendor/rails doesn’t exist until it’s run!).  
Unfortunately, rails-1.0 didn’t copy vendor/rails/railties/configs/  
lighttpd.conf from the trunk into vendor/rails. (This was fixed with  
[http://dev.rubyonrails.org/ticket/4047](http://dev.rubyonrails.org/ticket/4047))

Therefore, in order to get a _complete_ checkout of EdgeRails into  
vendor/rails is to actually run `rake freeze_edge` **twice**. The  
first time it uses the config from rails-1.0.0 (your gem install),  
the second time it runs the config from vendor/rails which correctly  
copies lighttpd.conf into your app.

- Peter

(1) - [Dan Benjamin](http://hivelogic.com/articles/2005/12/01/)  
ruby\_rails\_lighttpd\_mysql\_tiger
