Thorsten wrote:
> Does anyone have a working lighttpd.conf in connection with web.py and
> SCGI??
>
> I tried to follow http://blog.ericgoodwin.com/tags/lighttpd but all I
> get is the browser to display the content of myweb.py.
He is writing a configuration file for Ruby on Rails, web.py is a little
different. The idea is to tell lighttpd that your web.py application is
the fastcgi script:
"bin-path" => "/var/www/foo/code.py"
Don't forget to tell lighttpd that urls are not supposed to match local
files:
"check-local" => "disable"
A socket to let them communicate:
"socket" => "/tmp/fastcgi-py-foo.sock"
(Actually, I still don't know if web.py is threadsafe or not? There was
an issue with database connections a while ago and when I started out
the docs said it was not... so, how about it, guys? Just in case:
"max-procs" => 1
If somebody knows more about this, I'd really like to know.)
Putting it all together:
fastcgi.server = (
"/" =>
(( "bin-path" => "/var/www/foo/code.py",
"docroot" => "/var/www/foo",
"check-local" => "disable",
"socket" => "/tmp/fastcgi-py-foo.socket",
"max-procs"=> 1
))
)
This makes lighttpd call web.py for every request. For static files this
isn't very effective, so you can also do something like this:
url.rewrite-once( "^/favicon\.ico$" => "/favicon.ico",
"^/(.*)$" => "/py/$1" )
fastcgi.server = ("/py" => (( ... )) )
server.document-root = "/var/www/foo/lighty-static/"
This lets you serve the favicon.ico file statically. It works by making
letting web.py handle all URLs that begin with "/py/" and rewriting all
URLs except "/favicon.ico" to begin with "/py/". Note that even though
you can put them in a directory called "static" directly, this has two
downsides:
- Lighttpd still passes the request on to web.py.
- You get an ugly URL (/static/favicon.ico).
The downside to this method is that you have to restart lighttpd every
time you want to add new files. Of course you can do something like
"^/img/(.*)$" => "/img/$1" too, which will make lighttpd serve all files
from the image files statically and which won't get you any particularly
ugly URLs.
Anyway, that's about it :) Good luck.
b^4
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---