]> git.openstreetmap.org Git - rails.git/blob - config/lighttpd.conf
ffe2ea4f3adb364752b2201e6246794826bb0744
[rails.git] / config / lighttpd.conf
1 #
2 # Load the modules that we need
3 #
4 server.modules = ( 
5   "mod_access",
6   "mod_accesslog",
7   "mod_compress",
8   "mod_evasive",
9   "mod_fastcgi",
10   "mod_status"
11 )
12
13 #
14 # Basic server configuration
15 #
16 server.username = "www-data"
17 server.groupname = "www-data"
18 server.pid-file = "/var/run/lighttpd.pid"
19
20 #
21 # Setup logging
22 #
23 accesslog.filename = "/var/log/lighttpd/access.log"
24 server.errorlog = "/var/log/lighttpd/error.log"
25
26 #
27 # Allow munin to monitor the server's status
28 #
29 $HTTP["remoteip"] == "127.0.0.1" { status.status-url = "/server-status" }
30
31 #
32 # API 0.3 is long dead, so fail any attempt to access it without
33 # getting rails involved at all
34 #
35 $HTTP["url"] =~ "^/api/0.3/" { url.access-deny = ("") }
36
37 #
38 # IP blocked at SteveC's request as it was trying to download the
39 # history of every object in the database one at a time
40 #
41 $HTTP["remoteip"] == "143.210.16.160" { url.access-deny = ("") }
42
43 #
44 # Limit connections to 20 per IP address
45 #
46 evasive.max-conns-per-ip = 20
47
48 #
49 # Setup MIME type mapping
50 #
51 mimetype.assign = (
52   ".css" => "text/css",
53   ".gif" => "image/gif",
54   ".html" => "text/html",
55   ".js" => "application/x-javascript",
56   ".png" => "image/png",
57   ".swf" => "application/x-shockwave-flash",
58   ".txt" => "text/plain"
59 )
60
61 #
62 # Enable compression of appropriate static content
63 #
64 compress.filetype = ( 
65   "application/x-javascript",
66   "application/x-shockwave-flash",
67   "text/css",
68   "text/html",
69   "text/plain"
70 )
71
72 #
73 # Cache compressed content
74 #
75 compress.cache-dir = "/var/cache/lighttpd"
76
77 #
78 # Serve static content from the rails public area ourselves
79 #
80 server.document-root = "/var/www/rails/public"
81
82 #
83 # Send everything else to the appropriate FastCGI server
84 #
85 server.error-handler-404 = "/dispatch.fcgi"
86 $HTTP["url"] =~ "^/api/" { server.error-handler-404 = "/dispatch.api" }
87
88 #
89 # Configure the FastCGI servers
90 #
91 fastcgi.server = ( 
92   ".fcgi" => (
93     ( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ),
94     ( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ),
95     ( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ),
96     ( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ),
97     ( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ),
98     ( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" )
99   ),
100   ".api" => (
101     ( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ),
102     ( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ),
103     ( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" )
104   )
105 )