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