Allow nginx to autotune workers
[chef.git] / cookbooks / nginx / templates / default / nginx.conf.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 user  www-data;
4 worker_processes auto;
5 worker_cpu_affinity auto;
6 worker_rlimit_nofile 65536;
7
8 error_log  /var/log/nginx/error.log warn;
9 pid        /var/run/nginx.pid;
10
11
12 events {
13     worker_connections  1024;
14 }
15
16 http {
17     include       /etc/nginx/mime.types;
18     default_type  application/octet-stream;
19
20     server_names_hash_bucket_size 128;
21
22     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
23                       '$status $body_bytes_sent "$http_referer" '
24                       '"$http_user_agent" "$http_x_forwarded_for"';
25
26     access_log  /var/log/nginx/access.log  main  buffer=32k flush=1m;
27
28     keepalive_timeout  65;
29
30     server_tokens off;
31
32     <% if node['nginx']['cache']['fastcgi']['enable'] -%>
33     fastcgi_cache_path /var/cache/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'] %>;
34     <% end -%>
35     <% if node['nginx']['cache']['proxy']['enable'] -%>
36     proxy_cache_path /var/cache/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'] %>;
37     <% end -%>
38
39     include /etc/nginx/conf.d/*.conf;
40 }