]> git.openstreetmap.org Git - rails.git/blob - config/lighttpd.conf
Ignore traces which have not been inserted yet when calculating
[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 server.max-fds = 8192
23 server.reject-expect-100-with-417 = "disable"
24
25 #
26 # Setup logging
27 #
28 accesslog.filename = "/var/log/lighttpd/access.log"
29 server.errorlog = "/var/log/lighttpd/error.log"
30
31 #
32 # Allow munin to monitor the server's status
33 #
34 $HTTP["remoteip"] == "128.40.168.98" { 
35   status.config-url = "/server-config"
36   status.status-url = "/server-status"
37   status.statistics-url = "/server-statistics"
38 }
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 # Block JOSM revisions  1722-1727 as they have a serious bug that causes
54 # lat/lon to be swapped (http://josm.openstreetmap.de/ticket/2804)
55 #
56 $HTTP["useragent"] =~ "^JOSM/[0-9]+\.[0-9]+ \(172[234567] " {
57   url.access-deny = ("")
58 }
59
60 #
61 # Limit connections to 20 per IP address
62 #
63 evasive.max-conns-per-ip = 20
64
65 #
66 # Setup MIME type mapping
67 #
68 mimetype.assign = (
69   ".css" => "text/css",
70   ".gif" => "image/gif",
71   ".html" => "text/html; charset=utf-8",
72   ".jpg" => "image/jpeg",
73   ".js" => "application/x-javascript",
74   ".png" => "image/png",
75   ".swf" => "application/x-shockwave-flash",
76   ".txt" => "text/plain",
77   ".xml" => "text/xml"
78 )
79
80 #
81 # Force special MIME type for crossdomain.xml files
82 #
83 $HTTP["url"] =~ "/crossdomain\.xml$" {
84   mimetype.assign = ( ".xml" => "text/x-cross-domain-policy" )
85 }
86
87 #
88 # Enable compression of appropriate static content
89 #
90 compress.filetype = ( 
91   "application/x-javascript",
92   "application/x-shockwave-flash",
93   "text/css",
94   "text/html",
95   "text/plain"
96 )
97
98 #
99 # Set expiry for static content
100 #
101 expire.url = (
102   "/export/embed.html" => "access 7 days",
103   "/images/" => "access 10 years",
104   "/javascripts/" => "access 10 years",
105   "/openlayers/" => "access 7 days",
106   "/stylesheets/" => "access 10 years"
107 )
108
109 #
110 # Cache compressed content
111 #
112 compress.cache-dir = "/var/cache/lighttpd"
113
114 #
115 # Redirect trac and wiki requests to the right places
116 #
117 url.redirect = ( 
118   "^/trac/(.*)$" => "http://trac.openstreetmap.org/$1",
119   "^/wiki/(.*)$" => "http://wiki.openstreetmap.org/$1"
120 )
121
122 #
123 # Redirect everything except www.openstreetmap.org and
124 # api.openstreetmap.org to www.openstreetmap.org
125 #
126 $HTTP["host"] =~ "^api\." {
127   $HTTP["host"] != "api.openstreetmap.org" {
128     url.redirect = ( "^(.*)$" => "http://api.openstreetmap.org$1" )
129   }
130 }
131 else $HTTP["host"] != "www.openstreetmap.org" {
132   url.redirect = ( "^(.*)$" => "http://www.openstreetmap.org$1" )
133
134
135 #
136 # Run anything with a .pl iextension as a CGI script
137 #
138 cgi.assign = ( ".pl" => "/usr/bin/perl" )
139
140 #
141 # Serve static content from the rails public area ourselves
142 #
143 server.document-root = "/home/rails/public"
144
145 #
146 # Send everything else to the appropriate FastCGI server
147 #
148 $HTTP["useragent"] =~ "^tilesAtHome" {
149   server.error-handler-404 = "/dispatch.tah"
150 }
151 else $HTTP["url"] =~ "^/api/0\.6/(map|trackpoints|amf|amf/read|swf/trackpoints|changeset/[0-9]+/upload)$" {
152   server.error-handler-404 = "/dispatch.bulkapi"
153 }
154 else $HTTP["url"] =~ "^/api/0\.6/.*/(full|search)$" {
155   server.error-handler-404 = "/dispatch.bulkapi"
156 }
157 else $HTTP["url"] =~ "^/api/0\.6/" {
158   server.error-handler-404 = "/dispatch.api"
159 }
160 else $HTTP["url"] =~ "^/api/0\.[0-9]+/" {
161   url.access-deny = ("")
162 }
163 else $HTTP["url"] =~ "^/geocoder/(search|description)_osm_namefinder$" {
164   server.error-handler-404 = "/dispatch.namefinder"
165 }
166 else $HTTP["url"] =~ "^/geocoder/(search|description)_geonames$" {
167   server.error-handler-404 = "/dispatch.geonames"
168 }
169 else $HTTP["url"] =~ "^/" {
170   server.error-handler-404 = "/dispatch.web"
171 }
172
173 #
174 # Configure the FastCGI servers
175 #
176 fastcgi.server = ( 
177   ".web" => (
178     ( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ),
179     ( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ),
180     ( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ),
181     ( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ),
182     ( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ),
183     ( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" ),
184     ( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ),
185     ( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ),
186     ( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" ),
187     ( "host" => "127.0.0.1", "port" => 8009, "check-local" => "disable" ),
188     ( "host" => "127.0.0.1", "port" => 8010, "check-local" => "disable" ),
189     ( "host" => "127.0.0.1", "port" => 8011, "check-local" => "disable" ),
190     ( "host" => "127.0.0.1", "port" => 8012, "check-local" => "disable" ),
191     ( "host" => "127.0.0.1", "port" => 8013, "check-local" => "disable" ),
192     ( "host" => "127.0.0.1", "port" => 8014, "check-local" => "disable" ),
193     ( "host" => "127.0.0.1", "port" => 8015, "check-local" => "disable" ),
194     ( "host" => "127.0.0.1", "port" => 8016, "check-local" => "disable" ),
195     ( "host" => "127.0.0.1", "port" => 8017, "check-local" => "disable" ),
196     ( "host" => "127.0.0.1", "port" => 8018, "check-local" => "disable" ),
197     ( "host" => "127.0.0.1", "port" => 8019, "check-local" => "disable" ),
198     ( "host" => "127.0.0.1", "port" => 8020, "check-local" => "disable" ),
199     ( "host" => "127.0.0.1", "port" => 8021, "check-local" => "disable" ),
200     ( "host" => "127.0.0.1", "port" => 8022, "check-local" => "disable" ),
201     ( "host" => "127.0.0.1", "port" => 8023, "check-local" => "disable" ),
202     ( "host" => "127.0.0.1", "port" => 8024, "check-local" => "disable" ),
203     ( "host" => "127.0.0.1", "port" => 8025, "check-local" => "disable" )
204   ),
205   ".namefinder" => (
206     ( "host" => "127.0.0.1", "port" => 8026, "check-local" => "disable" ),
207     ( "host" => "127.0.0.1", "port" => 8027, "check-local" => "disable" ),
208     ( "host" => "127.0.0.1", "port" => 8028, "check-local" => "disable" ),
209     ( "host" => "127.0.0.1", "port" => 8029, "check-local" => "disable" )
210   ),
211   ".geonames" => (
212     ( "host" => "127.0.0.1", "port" => 8030, "check-local" => "disable" ),
213     ( "host" => "127.0.0.1", "port" => 8031, "check-local" => "disable" ),
214     ( "host" => "127.0.0.1", "port" => 8032, "check-local" => "disable" ),
215     ( "host" => "127.0.0.1", "port" => 8033, "check-local" => "disable" )
216   ),
217   ".api" => (
218     ( "host" => "127.0.0.1", "port" => 8030, "check-local" => "disable" ),
219     ( "host" => "127.0.0.1", "port" => 8031, "check-local" => "disable" ),
220     ( "host" => "127.0.0.1", "port" => 8032, "check-local" => "disable" ),
221     ( "host" => "127.0.0.1", "port" => 8033, "check-local" => "disable" ),
222     ( "host" => "127.0.0.1", "port" => 8034, "check-local" => "disable" ),
223     ( "host" => "127.0.0.1", "port" => 8035, "check-local" => "disable" ),
224     ( "host" => "127.0.0.1", "port" => 8036, "check-local" => "disable" ),
225     ( "host" => "127.0.0.1", "port" => 8037, "check-local" => "disable" ),
226     ( "host" => "127.0.0.1", "port" => 8038, "check-local" => "disable" ),
227     ( "host" => "127.0.0.1", "port" => 8039, "check-local" => "disable" ),
228     ( "host" => "127.0.0.1", "port" => 8040, "check-local" => "disable" ),
229     ( "host" => "127.0.0.1", "port" => 8041, "check-local" => "disable" ),
230     ( "host" => "127.0.0.1", "port" => 8042, "check-local" => "disable" ),
231     ( "host" => "127.0.0.1", "port" => 8043, "check-local" => "disable" ),
232     ( "host" => "127.0.0.1", "port" => 8044, "check-local" => "disable" )
233   ),
234   ".bulkapi" => (
235     ( "host" => "10.0.0.10", "port" => 8000, "check-local" => "disable" ),
236     ( "host" => "10.0.0.11", "port" => 8000, "check-local" => "disable" ),
237     ( "host" => "10.0.0.12", "port" => 8000, "check-local" => "disable" ),
238     ( "host" => "10.0.0.10", "port" => 8001, "check-local" => "disable" ),
239     ( "host" => "10.0.0.11", "port" => 8001, "check-local" => "disable" ),
240     ( "host" => "10.0.0.12", "port" => 8001, "check-local" => "disable" ),
241     ( "host" => "10.0.0.10", "port" => 8002, "check-local" => "disable" ),
242     ( "host" => "10.0.0.11", "port" => 8002, "check-local" => "disable" ),
243     ( "host" => "10.0.0.12", "port" => 8002, "check-local" => "disable" ),
244     ( "host" => "10.0.0.10", "port" => 8003, "check-local" => "disable" ),
245     ( "host" => "10.0.0.11", "port" => 8003, "check-local" => "disable" ),
246     ( "host" => "10.0.0.12", "port" => 8003, "check-local" => "disable" ),
247     ( "host" => "10.0.0.10", "port" => 8004, "check-local" => "disable" ),
248     ( "host" => "10.0.0.11", "port" => 8004, "check-local" => "disable" ),
249     ( "host" => "10.0.0.12", "port" => 8004, "check-local" => "disable" ),
250     ( "host" => "10.0.0.10", "port" => 8005, "check-local" => "disable" ),
251     ( "host" => "10.0.0.11", "port" => 8005, "check-local" => "disable" ),
252     ( "host" => "10.0.0.12", "port" => 8005, "check-local" => "disable" ),
253     ( "host" => "10.0.0.10", "port" => 8006, "check-local" => "disable" ),
254     ( "host" => "10.0.0.11", "port" => 8006, "check-local" => "disable" ),
255     ( "host" => "10.0.0.12", "port" => 8006, "check-local" => "disable" ),
256     ( "host" => "10.0.0.10", "port" => 8007, "check-local" => "disable" ),
257     ( "host" => "10.0.0.11", "port" => 8007, "check-local" => "disable" ),
258     ( "host" => "10.0.0.12", "port" => 8007, "check-local" => "disable" ),
259     ( "host" => "10.0.0.10", "port" => 8008, "check-local" => "disable" ),
260     ( "host" => "10.0.0.11", "port" => 8008, "check-local" => "disable" ),
261     ( "host" => "10.0.0.12", "port" => 8008, "check-local" => "disable" ),
262     ( "host" => "10.0.0.10", "port" => 8009, "check-local" => "disable" ),
263     ( "host" => "10.0.0.11", "port" => 8009, "check-local" => "disable" ),
264     ( "host" => "10.0.0.12", "port" => 8009, "check-local" => "disable" ),
265     ( "host" => "10.0.0.10", "port" => 8010, "check-local" => "disable" ),
266     ( "host" => "10.0.0.11", "port" => 8010, "check-local" => "disable" ),
267     ( "host" => "10.0.0.12", "port" => 8010, "check-local" => "disable" ),
268   ),
269   ".tah" => (
270     ( "host" => "10.0.0.10", "port" => 8011, "check-local" => "disable" ),
271     ( "host" => "10.0.0.11", "port" => 8011, "check-local" => "disable" ),
272     ( "host" => "10.0.0.12", "port" => 8011, "check-local" => "disable" )
273   )
274 )