]> git.openstreetmap.org Git - rails.git/blob - config/lighttpd.conf
Remove @midnode assign
[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 accesslog.format = "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Accept-Language}i\""
30 server.errorlog = "/var/log/lighttpd/error.log"
31
32 #
33 # Allow munin to monitor the server's status
34 #
35 $HTTP["remoteip"] == "128.40.168.98" {
36   status.config-url = "/server-config"
37   status.status-url = "/server-status"
38   status.statistics-url = "/server-statistics"
39 }
40
41 #
42 # Pull in host blocks
43 #
44 include_shell "lighttpd-host-blocks.sh"
45
46 #
47 # Block some troublesome robots
48 #
49 #$HTTP["useragent"] =~ "msnbot" { url.access-deny = ("") }
50 $HTTP["useragent"] =~ "Twiceler" { url.access-deny = ("") }
51 $HTTP["useragent"] =~ "Baiduspider" { url.access-deny = ("") }
52 $HTTP["useragent"] =~ "Sosospider+" { url.access-deny = ("") }
53 #$HTTP["useragent"] =~ "Yahoo! Slurp" { url.access-deny = ("") }
54 $HTTP["useragent"] =~ "Yeti" { url.access-deny = ("") }
55 #$HTTP["useragent"] =~ "Googlebot" { url.access-deny = ("") }
56 $HTTP["useragent"] =~ "The Hare and the Hedgeho" { url.access-deny = ("") }
57
58 #
59 # Block tilesAtHome
60 #
61 $HTTP["useragent"] =~ "tilesAtHome" { url.access-deny = ("") }
62
63 #
64 # Block JOSM revisions  1722-1727 as they have a serious bug that causes
65 # lat/lon to be swapped (http://josm.openstreetmap.de/ticket/2804)
66 #
67 $HTTP["useragent"] =~ "^JOSM/[0-9]+\.[0-9]+ \(172[234567] " {
68   url.access-deny = ("")
69 }
70
71 #
72 # Setup MIME type mapping
73 #
74 mimetype.assign = (
75   ".css" => "text/css",
76   ".gif" => "image/gif",
77   ".html" => "text/html; charset=utf-8",
78   ".jpg" => "image/jpeg",
79   ".js" => "application/x-javascript",
80   ".png" => "image/png",
81   ".swf" => "application/x-shockwave-flash",
82   ".txt" => "text/plain",
83   ".xml" => "text/xml"
84 )
85
86 #
87 # Force special MIME type for crossdomain.xml files
88 #
89 $HTTP["url"] =~ "/crossdomain\.xml$" {
90   mimetype.assign = ( ".xml" => "text/x-cross-domain-policy" )
91 }
92
93 #
94 # Enable compression of appropriate static content
95 #
96 compress.filetype = ( 
97   "application/x-javascript",
98   "application/x-shockwave-flash",
99   "text/css",
100   "text/html",
101   "text/plain"
102 )
103
104 #
105 # Set expiry for static content
106 #
107 expire.url = (
108   "/export/embed.html" => "access 7 days",
109   "/images/" => "access 10 years",
110   "/javascripts/" => "access 10 years",
111   "/openlayers/" => "access 7 days",
112   "/stylesheets/" => "access 10 years"
113 )
114
115 #
116 # Cache compressed content
117 #
118 compress.cache-dir = "/var/cache/lighttpd"
119
120 #
121 # Redirect trac and wiki requests to the right places
122 #
123 url.redirect = ( 
124   "^/trac/(.*)$" => "http://trac.openstreetmap.org/$1",
125   "^/wiki/(.*)$" => "http://wiki.openstreetmap.org/$1"
126 )
127
128 #
129 # Redirect everything except www.openstreetmap.org and
130 # api.openstreetmap.org to www.openstreetmap.org
131 #
132 $HTTP["host"] =~ "^api\." {
133   $HTTP["host"] != "api.openstreetmap.org" {
134     url.redirect = ( "^(.*)$" => "http://api.openstreetmap.org$1" )
135   }
136 }
137 else $HTTP["host"] != "www.openstreetmap.org" {
138   url.redirect = ( "^(.*)$" => "http://www.openstreetmap.org$1" )
139
140
141 #
142 # Run anything with a .pl iextension as a CGI script
143 #
144 cgi.assign = ( ".pl" => "/usr/bin/perl" )
145
146 #
147 # Serve static content from the rails public area ourselves
148 #
149 server.document-root = "/home/rails/public"
150
151 #
152 # Send everything else to the appropriate FastCGI server
153 #
154 $HTTP["url"] =~ "^/trace/[0-9]+/data$" {
155   server.error-handler-404 = "/dispatch.bulkapi"
156 }
157 else $HTTP["url"] =~ "^/api/0\.6/map$" {
158   server.error-handler-404 = "/dispatch.map"
159 }
160 else $HTTP["url"] =~ "^/api/0\.6/(trackpoints|amf|amf/read|swf/trackpoints|changeset/[0-9]+/(upload|download))$" {
161   server.error-handler-404 = "/dispatch.bulkapi"
162 }
163 else $HTTP["url"] =~ "^/api/0\.6/.*/(full|history|search|ways)$" {
164   server.error-handler-404 = "/dispatch.bulkapi"
165 }
166 else $HTTP["url"] =~ "^/api/0\.6/" {
167   server.error-handler-404 = "/dispatch.api"
168 }
169 else $HTTP["url"] =~ "^/api/0\.[0-9]+/" {
170   url.access-deny = ("")
171 }
172 else $HTTP["url"] =~ "^/geocoder/(search|description)_geonames$" {
173   server.error-handler-404 = "/dispatch.geonames"
174 }
175 else $HTTP["url"] =~ "^/" {
176   server.error-handler-404 = "/dispatch.web"
177 }
178
179 #
180 # Configure the FastCGI servers
181 #
182 fastcgi.server = ( 
183   ".web" => (
184     ( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ),
185     ( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ),
186     ( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ),
187     ( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ),
188     ( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ),
189     ( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" ),
190     ( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ),
191     ( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ),
192     ( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" ),
193     ( "host" => "127.0.0.1", "port" => 8009, "check-local" => "disable" ),
194     ( "host" => "127.0.0.1", "port" => 8010, "check-local" => "disable" ),
195     ( "host" => "127.0.0.1", "port" => 8011, "check-local" => "disable" ),
196     ( "host" => "127.0.0.1", "port" => 8012, "check-local" => "disable" ),
197     ( "host" => "127.0.0.1", "port" => 8013, "check-local" => "disable" ),
198     ( "host" => "127.0.0.1", "port" => 8014, "check-local" => "disable" ),
199     ( "host" => "127.0.0.1", "port" => 8015, "check-local" => "disable" ),
200     ( "host" => "127.0.0.1", "port" => 8016, "check-local" => "disable" ),
201     ( "host" => "127.0.0.1", "port" => 8017, "check-local" => "disable" ),
202     ( "host" => "127.0.0.1", "port" => 8018, "check-local" => "disable" ),
203     ( "host" => "127.0.0.1", "port" => 8019, "check-local" => "disable" ),
204     ( "host" => "127.0.0.1", "port" => 8020, "check-local" => "disable" ),
205     ( "host" => "127.0.0.1", "port" => 8021, "check-local" => "disable" ),
206     ( "host" => "127.0.0.1", "port" => 8022, "check-local" => "disable" ),
207     ( "host" => "127.0.0.1", "port" => 8023, "check-local" => "disable" ),
208     ( "host" => "127.0.0.1", "port" => 8024, "check-local" => "disable" ),
209     ( "host" => "127.0.0.1", "port" => 8025, "check-local" => "disable" ),
210     ( "host" => "127.0.0.1", "port" => 8026, "check-local" => "disable" ),
211     ( "host" => "127.0.0.1", "port" => 8027, "check-local" => "disable" ),
212     ( "host" => "127.0.0.1", "port" => 8028, "check-local" => "disable" ),
213     ( "host" => "127.0.0.1", "port" => 8029, "check-local" => "disable" )
214   ),
215   ".geonames" => (
216     ( "host" => "127.0.0.1", "port" => 8030, "check-local" => "disable" ),
217     ( "host" => "127.0.0.1", "port" => 8031, "check-local" => "disable" ),
218     ( "host" => "127.0.0.1", "port" => 8032, "check-local" => "disable" ),
219     ( "host" => "127.0.0.1", "port" => 8033, "check-local" => "disable" )
220   ),
221   ".api" => (
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     ( "host" => "127.0.0.1", "port" => 8045, "check-local" => "disable" ),
234     ( "host" => "127.0.0.1", "port" => 8046, "check-local" => "disable" ),
235     ( "host" => "127.0.0.1", "port" => 8047, "check-local" => "disable" ),
236     ( "host" => "127.0.0.1", "port" => 8048, "check-local" => "disable" )
237   ),
238   ".bulkapi" => (
239     ( "host" => "10.0.0.10", "port" => 8000, "check-local" => "disable" ),
240     ( "host" => "10.0.0.11", "port" => 8000, "check-local" => "disable" ),
241     ( "host" => "10.0.0.12", "port" => 8000, "check-local" => "disable" ),
242     ( "host" => "10.0.0.10", "port" => 8001, "check-local" => "disable" ),
243     ( "host" => "10.0.0.11", "port" => 8001, "check-local" => "disable" ),
244     ( "host" => "10.0.0.12", "port" => 8001, "check-local" => "disable" ),
245     ( "host" => "10.0.0.10", "port" => 8002, "check-local" => "disable" ),
246     ( "host" => "10.0.0.11", "port" => 8002, "check-local" => "disable" ),
247     ( "host" => "10.0.0.12", "port" => 8002, "check-local" => "disable" ),
248     ( "host" => "10.0.0.10", "port" => 8003, "check-local" => "disable" ),
249     ( "host" => "10.0.0.11", "port" => 8003, "check-local" => "disable" ),
250     ( "host" => "10.0.0.12", "port" => 8003, "check-local" => "disable" ),
251     ( "host" => "10.0.0.10", "port" => 8004, "check-local" => "disable" ),
252     ( "host" => "10.0.0.11", "port" => 8004, "check-local" => "disable" ),
253     ( "host" => "10.0.0.12", "port" => 8004, "check-local" => "disable" ),
254     ( "host" => "10.0.0.10", "port" => 8005, "check-local" => "disable" ),
255     ( "host" => "10.0.0.11", "port" => 8005, "check-local" => "disable" ),
256     ( "host" => "10.0.0.12", "port" => 8005, "check-local" => "disable" ),
257     ( "host" => "10.0.0.10", "port" => 8006, "check-local" => "disable" ),
258     ( "host" => "10.0.0.11", "port" => 8006, "check-local" => "disable" ),
259     ( "host" => "10.0.0.12", "port" => 8006, "check-local" => "disable" ),
260     ( "host" => "10.0.0.10", "port" => 8007, "check-local" => "disable" ),
261     ( "host" => "10.0.0.11", "port" => 8007, "check-local" => "disable" ),
262     ( "host" => "10.0.0.12", "port" => 8007, "check-local" => "disable" ),
263     ( "host" => "10.0.0.10", "port" => 8008, "check-local" => "disable" ),
264     ( "host" => "10.0.0.11", "port" => 8008, "check-local" => "disable" ),
265     ( "host" => "10.0.0.12", "port" => 8008, "check-local" => "disable" ),
266     ( "host" => "10.0.0.10", "port" => 8009, "check-local" => "disable" ),
267     ( "host" => "10.0.0.11", "port" => 8009, "check-local" => "disable" ),
268     ( "host" => "10.0.0.12", "port" => 8009, "check-local" => "disable" ),
269     ( "host" => "10.0.0.10", "port" => 8010, "check-local" => "disable" ),
270     ( "host" => "10.0.0.11", "port" => 8010, "check-local" => "disable" ),
271     ( "host" => "10.0.0.12", "port" => 8010, "check-local" => "disable" ),
272     ( "host" => "10.0.0.10", "port" => 8011, "check-local" => "disable" ),
273     ( "host" => "10.0.0.11", "port" => 8011, "check-local" => "disable" ),
274     ( "host" => "10.0.0.12", "port" => 8011, "check-local" => "disable" )
275   ),
276   ".map" => (
277     ( "host" => "10.0.0.10", "port" => 9000, "check-local" => "disable" ),
278     ( "host" => "10.0.0.11", "port" => 9000, "check-local" => "disable" ),
279     ( "host" => "10.0.0.12", "port" => 9000, "check-local" => "disable" )
280   )
281 )