Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (50 sloc) 1.408 kB
018940c @tzuryby edit
tzuryby authored
1 ---
2 layout: default
3 title: Webpy + LightTTPD with FastCGi
4 ---
5
6 # Webpy + LightTTPD with FastCGi
7
8 The following applies to lighttpd version 1.4.18
9
10 Earlier version may organize the xxx.conf files differently but the same principles applied to them as well.
11
12 Below are instructions for the following files:
13 * lighttpd.conf
14 * mod_rewrite.conf
15 * code.py
16
17 <code>/etc/lighttpd/lighttpd.conf</code>
18
19 <pre>
20 server.modules = (
21 "mod_access",
22 "mod_alias",
23 "mod_accesslog",
24 "mod_compress",
25 )
26 server.document-root = "/path/to/webpy/app/root-dir"
27 </pre>
28
29 In my case I used postgresql and therefore runs lighttpd as postgres in order to grant permissions to the database, therefore I added the line:
30
31 <pre>
32 server.username = "postgres"
33 </pre>
34
35 <code>conf-enabled/10-fastcgi.conf</code>
36
37 <pre>
38
39 server.modules += ( "mod_fastcgi" )
40 server.modules += ( "mod_rewrite" )
41
42 fastcgi.server = ( "/code.py" =>
43 (( "socket" => "/tmp/fastcgi.socket",
44 "bin-path" => "/path/to/code.py",
45 "max-procs" => 1,
46 "bin-environment" => (
47 "REAL_SCRIPT_NAME" => ""
48 ),
49 "check-local" => "disable"
50 ))
51 )
52
53 url.rewrite-once = (
54 "^/favicon.ico$" => "/static/favicon.ico",
55 "^/static/(.*)$" => "/static/$1",
56 "^/(.*)$" => "/code.py/$1",
57 )
58 </pre>
59
60 <code>/code.py</code>
61 at the top of the file add:
62
63 <pre>
64 #!/usr/bin/env python
65 </pre>
Something went wrong with that request. Please try again.