]> git.openstreetmap.org Git - rails.git/blob - config/lighttpd.conf
Detabify.
[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" { 
33   status.config-url = "/server-config"
34   status.status-url = "/server-status"
35   status.statistics-url = "/server-statistics"
36 }
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; charset=utf-8",
62   ".js" => "application/x-javascript",
63   ".png" => "image/png",
64   ".swf" => "application/x-shockwave-flash",
65   ".txt" => "text/plain",
66   ".xml" => "text/xml"
67 )
68
69 #
70 # Force special MIME type for crossdomain.xml files
71 #
72 $HTTP["url"] =~ "/crossdomain\.xml$" {
73   mimetype.assign = ( ".xml" => "text/x-cross-domain-policy" )
74 }
75
76 #
77 # Enable compression of appropriate static content
78 #
79 compress.filetype = ( 
80   "application/x-javascript",
81   "application/x-shockwave-flash",
82   "text/css",
83   "text/html",
84   "text/plain"
85 )
86
87 #
88 # Set expiry for static content
89 #
90 expire.url = (
91   "/export/" => "access 7 days",
92   "/images/" => "access 10 years",
93   "/javascripts/" => "access 10 years",
94   "/openlayers/" => "access 7 days",
95   "/stylesheets/" => "access 10 years"
96 )
97
98 #
99 # Cache compressed content
100 #
101 compress.cache-dir = "/var/cache/lighttpd"
102
103 #
104 # Redirect trac and wiki requests to the right places
105 #
106 url.redirect = ( 
107   "^/trac/(.*)$" => "http://trac.openstreetmap.org/$1",
108   "^/wiki/(.*)$" => "http://wiki.openstreetmap.org/$1"
109 )
110
111 #
112 # Run anything with a .pl iextension as a CGI script
113 #
114 cgi.assign = ( ".pl" => "/usr/bin/perl" )
115
116 #
117 # Serve static content from the rails public area ourselves
118 #
119 server.document-root = "/home/rails/public"
120
121 #
122 # Send everything else to the appropriate FastCGI server
123 #
124 $HTTP["useragent"] == "tilesAtHome" {
125   server.error-handler-404 = "/dispatch.tah"
126 }
127 else $HTTP["url"] =~ "^/api/0\.5/(map|trackpoints|amf|amf/read|swf/trackpoints)$" {
128   server.error-handler-404 = "/dispatch.bulkapi"
129 }
130 else $HTTP["url"] =~ "^/api/0\.5/.*/search$" {
131   server.error-handler-404 = "/dispatch.bulkapi"
132 }
133 else $HTTP["url"] =~ "^/api/0\.5/" {
134   server.error-handler-404 = "/dispatch.api"
135 }
136 else $HTTP["url"] =~ "^/api/0\.[0-9]+/" {
137   url.access-deny = ("")
138 }
139 else $HTTP["url"] =~ "^/" {
140   server.error-handler-404 = "/dispatch.web"
141 }
142
143 #
144 # Configure the FastCGI servers
145 #
146 fastcgi.server = ( 
147   ".web" => (
148     ( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ),
149     ( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ),
150     ( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ),
151     ( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ),
152     ( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ),
153     ( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" ),
154     ( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ),
155     ( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ),
156     ( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" ),
157     ( "host" => "127.0.0.1", "port" => 8009, "check-local" => "disable" ),
158     ( "host" => "127.0.0.1", "port" => 8010, "check-local" => "disable" ),
159     ( "host" => "127.0.0.1", "port" => 8011, "check-local" => "disable" ),
160     ( "host" => "127.0.0.1", "port" => 8012, "check-local" => "disable" ),
161     ( "host" => "127.0.0.1", "port" => 8013, "check-local" => "disable" ),
162     ( "host" => "127.0.0.1", "port" => 8014, "check-local" => "disable" ),
163     ( "host" => "127.0.0.1", "port" => 8015, "check-local" => "disable" ),
164     ( "host" => "127.0.0.1", "port" => 8016, "check-local" => "disable" ),
165     ( "host" => "127.0.0.1", "port" => 8017, "check-local" => "disable" ),
166     ( "host" => "127.0.0.1", "port" => 8018, "check-local" => "disable" ),
167     ( "host" => "127.0.0.1", "port" => 8019, "check-local" => "disable" ),
168     ( "host" => "127.0.0.1", "port" => 8020, "check-local" => "disable" ),
169     ( "host" => "127.0.0.1", "port" => 8021, "check-local" => "disable" ),
170     ( "host" => "127.0.0.1", "port" => 8022, "check-local" => "disable" ),
171     ( "host" => "127.0.0.1", "port" => 8023, "check-local" => "disable" ),
172     ( "host" => "127.0.0.1", "port" => 8024, "check-local" => "disable" ),
173     ( "host" => "127.0.0.1", "port" => 8025, "check-local" => "disable" ),
174     ( "host" => "127.0.0.1", "port" => 8026, "check-local" => "disable" ),
175     ( "host" => "127.0.0.1", "port" => 8027, "check-local" => "disable" ),
176     ( "host" => "127.0.0.1", "port" => 8028, "check-local" => "disable" ),
177     ( "host" => "127.0.0.1", "port" => 8029, "check-local" => "disable" )
178   ),
179   ".api" => (
180     ( "host" => "127.0.0.1", "port" => 8030, "check-local" => "disable" ),
181     ( "host" => "127.0.0.1", "port" => 8031, "check-local" => "disable" ),
182     ( "host" => "127.0.0.1", "port" => 8032, "check-local" => "disable" ),
183     ( "host" => "127.0.0.1", "port" => 8033, "check-local" => "disable" ),
184     ( "host" => "127.0.0.1", "port" => 8034, "check-local" => "disable" ),
185     ( "host" => "127.0.0.1", "port" => 8035, "check-local" => "disable" ),
186     ( "host" => "127.0.0.1", "port" => 8036, "check-local" => "disable" ),
187     ( "host" => "127.0.0.1", "port" => 8037, "check-local" => "disable" ),
188     ( "host" => "127.0.0.1", "port" => 8038, "check-local" => "disable" ),
189     ( "host" => "127.0.0.1", "port" => 8039, "check-local" => "disable" ),
190     ( "host" => "127.0.0.1", "port" => 8040, "check-local" => "disable" ),
191     ( "host" => "127.0.0.1", "port" => 8041, "check-local" => "disable" ),
192     ( "host" => "127.0.0.1", "port" => 8042, "check-local" => "disable" ),
193     ( "host" => "127.0.0.1", "port" => 8043, "check-local" => "disable" ),
194     ( "host" => "127.0.0.1", "port" => 8044, "check-local" => "disable" )
195   ),
196   ".bulkapi" => (
197     ( "host" => "10.0.0.10", "port" => 8000, "check-local" => "disable" ),
198     ( "host" => "10.0.0.11", "port" => 8000, "check-local" => "disable" ),
199     ( "host" => "10.0.0.12", "port" => 8000, "check-local" => "disable" ),
200     ( "host" => "10.0.0.10", "port" => 8001, "check-local" => "disable" ),
201     ( "host" => "10.0.0.11", "port" => 8001, "check-local" => "disable" ),
202     ( "host" => "10.0.0.12", "port" => 8001, "check-local" => "disable" ),
203     ( "host" => "10.0.0.10", "port" => 8002, "check-local" => "disable" ),
204     ( "host" => "10.0.0.11", "port" => 8002, "check-local" => "disable" ),
205     ( "host" => "10.0.0.12", "port" => 8002, "check-local" => "disable" ),
206     ( "host" => "10.0.0.10", "port" => 8003, "check-local" => "disable" ),
207     ( "host" => "10.0.0.11", "port" => 8003, "check-local" => "disable" ),
208     ( "host" => "10.0.0.12", "port" => 8003, "check-local" => "disable" )
209   ),
210   ".tah" => (
211     ( "host" => "10.0.0.10", "port" => 8004, "check-local" => "disable" ),
212     ( "host" => "10.0.0.11", "port" => 8004, "check-local" => "disable" ),
213     ( "host" => "10.0.0.12", "port" => 8004, "check-local" => "disable" ),
214     ( "host" => "10.0.0.10", "port" => 8005, "check-local" => "disable" ),
215     ( "host" => "10.0.0.11", "port" => 8005, "check-local" => "disable" ),
216     ( "host" => "10.0.0.12", "port" => 8005, "check-local" => "disable" )
217   )
218 )