]> git.openstreetmap.org Git - chef.git/blob - cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb
Search rank for new namespace
[chef.git] / cookbooks / imagery / templates / default / nginx_imagery_layer_fragment.conf.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2 location ~* "^/layer/<%= @layer %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" {
3   # Override QUERY_STRING to force mapserver query parameters
4   fastcgi_param QUERY_STRING "map=/srv/imagery/mapserver/layer-<%= @layer %>.map&mode=tile&layers=<%= @layer %>&tilemode=gmap&tile=$2+$3+$1";
5   fastcgi_pass "<%= @site %>_fastcgi";
6   fastcgi_buffers 8 64k;
7   include fastcgi_params;
8   fastcgi_param REQUEST_METHOD "GET";
9   fastcgi_param HTTP_PROXY "";
10   fastcgi_read_timeout 60s;
11
12   # Caching
13   fastcgi_cache "fastcgi_cache_zone";
14   fastcgi_cache_key "<%= @layer %><%= @revision %> $request_method $1 $2 $3";
15
16   # Free connection to socket for other requests
17   fastcgi_keep_conn off;
18
19   fastcgi_cache_lock on;
20   fastcgi_cache_lock_timeout 30s;
21   fastcgi_cache_valid 200 21d;
22   fastcgi_cache_use_stale error timeout updating http_500 http_503;
23
24   # Ignore client abort as it causes issues with the pipeline
25   fastcgi_ignore_client_abort on;
26
27   fastcgi_catch_stderr "Image handling error";
28
29   fastcgi_next_upstream error timeout invalid_header http_500 http_503;
30   fastcgi_next_upstream_tries 8;
31
32   # Do not GZIP tiles
33   gzip off;
34
35   # Add HTTP Cache-Control + Expires Headers
36   expires 7d;
37
38   # Allow CORS requests
39   add_header 'Access-Control-Allow-Origin' '*';
40 }
41
42 <% if @root_layer -%>
43 rewrite "^/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" "/layer/<%= @layer %>/$1/$2/$3.$4" last;
44 <% end -%>
45 <% @url_aliases.each do |url| -%>
46 rewrite "^<%= url %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" "/layer/<%= @layer %>/$1/$2/$3.$4" last;
47 <% end -%>