Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (50 sloc) 1.401 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
3671502 @tzuryby edit
tzuryby authored
37 <pre>
6f3f158 @tzuryby edit
tzuryby authored
38 server.modules += ( "mod_fastcgi" )
39 server.modules += ( "mod_rewrite" )
018940c @tzuryby edit
tzuryby authored
40
41 fastcgi.server = ( "/code.py" =>
42 (( "socket" => "/tmp/fastcgi.socket",
43 "bin-path" => "/path/to/code.py",
44 "max-procs" => 1,
45 "bin-environment" => (
46 "REAL_SCRIPT_NAME" => ""
47 ),
48 "check-local" => "disable"
49 ))
50 )
51
52 url.rewrite-once = (
53 "^/favicon.ico$" => "/static/favicon.ico",
54 "^/static/(.*)$" => "/static/$1",
55 "^/(.*)$" => "/code.py/$1",
56 )
57 </pre>
58
59 <code>/code.py</code>
60 at the top of the file add:
61
62 <pre>
63 #!/usr/bin/env python
64 </pre>
Something went wrong with that request. Please try again.