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