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