# Lighttpd rails

**URL:** <https://www.ruby-forum.com/t/lighttpd-rails/86232>\
**Category:** Rails\
**Created:** [March 23, 2006, 7:52pm UTC](https://www.ruby-forum.com/t/lighttpd-rails/86232 "2006-03-23T19:52:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/49beb7/32.png) [@Vincent\_G](https://www.ruby-forum.com/u/Vincent_G)\
**Post date:** [March 23, 2006, 7:52pm UTC](https://www.ruby-forum.com/t/lighttpd-rails/86232/1 "2006-03-23T19:52:19Z")

</div>

I’m running lighttpd + fastcgi + rails  
Say that the lighttpd root directory is the rails application /public  
directory.  
I’m just curious.  
If theres a file in the document root with the same name as a  
controller,  
does the file get served first?  
How does that work? Does lighttpd check the root directory first to see  
if  
the file exists- If not, it calls dispatch.fcgi? I want to know if the  
rails app is called in any way if i’m just serving static files that are  
in  
the /public directory- such as images and text files.

---

<div class="post-metadata">

**Author:** ![Vincent\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/49beb7/32.png) [@Vincent\_G](https://www.ruby-forum.com/u/Vincent_G)\
**Post date:** [March 23, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/lighttpd-rails/86232/2 "2006-03-23T22:33:07Z")

</div>

On Mar 23, 2006, at 10:52 AM, Vincent G. wrote:

> text files.
> 
> –  
> Vincent H Gov
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Vincent-

```
The way dispatch.fcgi works is that it is assigned to be the error

```

handler in the lighty.conf file./ So lighty first checks public for  
files that match the url and serves them directly without invoking  
rails if they exist. If they don’t exist then a 404 error is raised  
and sent to dispatch.fcgi for rails to sort out.

```
This liine in your lighttpd.conf file is what looks for fo.html if

```

the url is /foo

```
     url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" =>

```

“$1.html” )

```
So the short answer is yes, if you put .html files in the public dir

```

or any subdir in public it will get served by lighty without ever  
invoking rails.

Cheers-  
-Ezra

---

<div class="post-metadata">

**Author:** ![Vincent\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/49beb7/32.png) [@Vincent\_G](https://www.ruby-forum.com/u/Vincent_G)\
**Post date:** [March 24, 2006, 5:09am UTC](https://www.ruby-forum.com/t/lighttpd-rails/86232/3 "2006-03-24T05:09:30Z")

</div>

hmm… those lines are commented out in my conf file.
