nginx: add munin monitoring
[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 98304;
7
8 error_log  /var/log/nginx/error.log warn;
9 pid        /var/run/nginx.pid;
10
11
12 events {
13     worker_connections  8192;
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     map_hash_bucket_size 128;
22
23 <% if node[:nginx][:access_log] -%>
24     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
25                       '$status $body_bytes_sent "$http_referer" '
26                       '"$http_user_agent" "$http_x_forwarded_for"';
27
28     access_log  <%= node[:nginx][:access_log] %>  main  buffer=32k flush=1m;
29 <% else -%>
30     access_log  off;
31 <% end -%>
32
33     keepalive_timeout  30;
34
35     server_tokens off;
36
37     ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
38     ssl_ciphers <%= node[:ssl][:openssl_ciphers] -%>;
39     ssl_prefer_server_ciphers on;
40     ssl_session_cache shared:SSL:50m;
41     ssl_session_timeout 30m;
42
43     ssl_stapling on;
44
45     # Validate the stapling response is signed by a trusted certificate
46     ssl_stapling_verify on;
47     ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
48
49     ssl_dhparam /etc/ssl/certs/dhparam.pem;
50     resolver <%= @resolvers.join(" ") %>;
51     resolver_timeout 5s;
52
53     <% if node['nginx']['cache']['fastcgi']['enable'] -%>
54     fastcgi_cache_path /var/cache/nginx/fastcgi-cache levels=1:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['fastcgi']['keys_zone'] %> inactive=<%= node['nginx']['cache']['fastcgi']['inactive'] %> max_size=<%= node['nginx']['cache']['fastcgi']['max_size'] %>;
55     <% end -%>
56     <% if node['nginx']['cache']['proxy']['enable'] -%>
57     proxy_cache_path /var/cache/nginx/proxy-cache levels=1:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['proxy']['keys_zone'] %> inactive=<%= node['nginx']['cache']['proxy']['inactive'] %> max_size=<%= node['nginx']['cache']['proxy']['max_size'] %>;
58     <% end -%>
59
60     # Internal site for munin monitoring
61     server {
62       listen 127.0.0.1:8050;
63       server_name localhost;
64       location /nginx_status {
65         stub_status on;
66         access_log off;
67         allow 127.0.0.1;
68         deny all;
69       }
70     }
71
72     include /etc/nginx/conf.d/*.conf;
73 }