]> git.openstreetmap.org Git - rails.git/blob - config/lighttpd.conf
Tidy up map browse code and qualify various global names to avoid
[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   "/export/" => "access 7 days",
87   "/images/" => "access 10 years",
88   "/javascripts/" => "access 10 years",
89   "/openlayers/" => "access 7 days",
90   "/stylesheets/" => "access 10 years"
91 )
92
93 #
94 # Cache compressed content
95 #
96 compress.cache-dir = "/var/cache/lighttpd"
97
98 #
99 # Redirect trac and wiki requests to the right places
100 #
101 url.redirect = ( 
102   "^/trac/(.*)$" => "http://trac.openstreetmap.org/$1",
103   "^/wiki/(.*)$" => "http://wiki.openstreetmap.org/$1"
104 )
105
106 #
107 # Run anything with a .pl iextension as a CGI script
108 #
109 cgi.assign = ( ".pl" => "/usr/bin/perl" )
110
111 #
112 # Serve static content from the rails public area ourselves
113 #
114 server.document-root = "/var/www/rails/public"
115
116 #
117 # Send everything else to the appropriate FastCGI server
118 #
119 server.error-handler-404 = "/dispatch.fcgi"
120 $HTTP["url"] =~ "^/api/" { server.error-handler-404 = "/dispatch.api" }
121
122 #
123 # Configure the FastCGI servers
124 #
125 fastcgi.server = ( 
126   ".fcgi" => (
127     ( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ),
128     ( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ),
129     ( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ),
130     ( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ),
131     ( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ),
132     ( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" )
133   ),
134   ".api" => (
135     ( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ),
136     ( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ),
137     ( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" )
138   )
139 )