fastcgi_param QUERY_STRING "map=/srv/imagery/mapserver/layer-<%= @layer %>.map&mode=tile&layers=<%= @layer %>&tilemode=gmap&tile=$2+$3+$1";
fastcgi_pass "unix:/var/run/mapserver-fastcgi/layer-<%= @layer %>.socket";
fastcgi_buffers 8 64k;
+ fastcgi_cache "fastcgi_cache_zone"
include fastcgi_params;
gzip off;
-# default[:nginx][:mpm] = "worker"
+# Tuning for nginx fastcgi cache zone
+default[:nginx][:cache][:fastcgi][:enable] = false
+default[:nginx][:cache][:fastcgi][:keys_zone] = "fastcgi_cache_zone:32m"
+default[:nginx][:cache][:fastcgi][:inactive] = "30d"
+default[:nginx][:cache][:fastcgi][:max_size] = "2048m"
+
+# Tuning for nginx proxy cache zone
+default[:nginx][:cache][:proxy][:enable] = false
+default[:nginx][:cache][:proxy][:keys_zone] = "proxy_cache_zone:32m"
+default[:nginx][:cache][:proxy][:inactive] = "30d"
+default[:nginx][:cache][:proxy][:max_size] = "2048m"
mode 0644
end
+if node['nginx']['cache']['fastcgi']['enable']
+ directory "/var/lib/nginx/fastcgi-cache" do
+ owner "nginx"
+ group "nginx"
+ mode 0755
+ end
+end
+
+if node['nginx']['cache']['proxy']['enable']
+ directory "/var/lib/nginx/proxy-cache" do
+ owner "nginx"
+ group "nginx"
+ mode 0755
+ end
+end
+
service "nginx" do
action [:enable]
supports :status => true, :restart => true, :reload => true
server_tokens off;
+ <% if node['nginx']['cache']['fastcgi']['enable'] -%>
+ fastcgi_cache_path /var/lib/nginx/fastcgi-cache levels=1:2 keys_zone=<%= node['nginx']['cache']['fastcgi']['keys_zone'] %> inactive=<%= node['nginx']['cache']['fastcgi']['inactive'] %> max_size=<%= node['nginx']['cache']['fastcgi']['max_size'] %>;
+ <% end -%>
+ <% if node['nginx']['cache']['proxy']['enable'] -%>
+ fastcgi_cache_path /var/lib/nginx/proxy-cache levels=1:2 keys_zone=<%= node['nginx']['cache']['proxy']['keys_zone'] %> inactive=<%= node['nginx']['cache']['proxy']['inactive'] %> max_size=<%= node['nginx']['cache']['proxy']['max_size'] %>;
+ <% end -%>
+
include /etc/nginx/conf.d/*.conf;
}
"kernel.sched_wakeup_granularity_ns" => 15000000
}
}
+ },
+ :nginx => {
+ :cache => {
+ :fastcgi => {
+ :enable => true
+ }
+ }
}
)