module-nginx/templates/conf.d/nginx.conf.erb

98 lines
2.8 KiB
Text
Raw Normal View History

<% if @super_user -%>
user <%= @daemon_user %>;
<% end -%>
2013-07-17 20:42:57 +02:00
worker_processes <%= @worker_processes %>;
<% if @worker_rlimit_nofile -%>
worker_rlimit_nofile <%= @worker_rlimit_nofile %>;
<% end -%>
2011-06-07 00:25:04 +02:00
<% if @pid -%>
pid <%= @pid %>;
<% end -%>
error_log <%= @nginx_error_log %>;
2011-06-07 00:25:04 +02:00
<% if @nginx_cfg_prepend -%>
<%- field_width = @nginx_cfg_prepend.inject(0) { |l,(k,v)| k.size > l ? k.size : l } -%>
<%- @nginx_cfg_prepend.sort_by{|k,v| k}.each do |key,value| -%>
<%- Array(value).each do |asubvalue| -%>
<%= sprintf("%-*s", field_width, key) %> <%= asubvalue %>;
<%- end -%>
<%- end -%>
<% end -%>
2011-06-07 00:25:04 +02:00
events {
worker_connections <%= @worker_connections -%>;
<%- if @multi_accept == 'on' -%>
multi_accept on;
<%- end -%>
<%- if @events_use -%>
use <%= @events_use %>;
<%- end -%>
2011-06-07 00:25:04 +02:00
}
http {
include <%= @conf_dir %>/mime.types;
2011-06-07 00:25:04 +02:00
default_type application/octet-stream;
2014-08-02 09:04:43 +02:00
<% if @log_format -%>
<% @log_format.sort_by{|k,v| k}.each do |key,value| -%>
log_format <%= key %> '<%= value %>';
<% end -%>
<% end -%>
2011-06-07 00:25:04 +02:00
access_log <%= @http_access_log %>;
2011-06-07 00:25:04 +02:00
<% if @sendfile == 'on' -%>
sendfile on;
<%- if @http_tcp_nopush == 'on' -%>
tcp_nopush on;
<%- end -%>
<% end -%>
2011-06-07 00:25:04 +02:00
2013-07-17 20:42:57 +02:00
server_tokens <%= @server_tokens %>;
2011-06-07 00:25:04 +02:00
types_hash_max_size <%= @types_hash_max_size %>;
types_hash_bucket_size <%= @types_hash_bucket_size %>;
2011-06-07 00:25:04 +02:00
server_names_hash_bucket_size <%= @names_hash_bucket_size %>;
server_names_hash_max_size <%= @names_hash_max_size %>;
keepalive_timeout <%= @keepalive_timeout %>;
tcp_nodelay <%= @http_tcp_nodelay %>;
2011-06-07 00:25:04 +02:00
<% if @gzip == 'on' -%>
2011-06-07 00:25:04 +02:00
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
<% end -%>
<% if @proxy_cache_path -%>
proxy_cache_path <%= @proxy_cache_path %> levels=<%= @proxy_cache_levels %> keys_zone=<%= @proxy_cache_keys_zone %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>;
2011-06-07 00:25:04 +02:00
<% end -%>
2014-04-26 16:34:29 +02:00
<% if @fastcgi_cache_path -%>
fastcgi_cache_path <%= @fastcgi_cache_path %> levels=<%= @fastcgi_cache_levels %> keys_zone=<%= @fastcgi_cache_keys_zone %> max_size=<%= @fastcgi_cache_max_size %> inactive=<%= @fastcgi_cache_inactive %>;
<% end -%>
<% if @fastcgi_cache_key -%>
fastcgi_cache_key <%= @fastcgi_cache_key %>;
<% end -%>
<% if @fastcgi_cache_use_stale -%>
fastcgi_cache_use_stale <%= @fastcgi_cache_use_stale %>;
2014-04-26 16:34:29 +02:00
<% end -%>
<% if @http_cfg_append -%>
2014-04-26 16:34:29 +02:00
<%- field_width = @http_cfg_append.inject(0) { |l,(k,v)| k.size > l ? k.size : l } -%>
<%- @http_cfg_append.sort_by{|k,v| k}.each do |key,value| -%>
2014-12-11 16:15:42 +01:00
<%- Array(value).each do |asubvalue| -%>
<%= sprintf("%-*s", field_width, key) %> <%= asubvalue %>;
<%- end -%>
<%- end -%>
<% end -%>
include <%= @conf_dir %>/conf.d/*.conf;
include <%= @conf_dir %>/sites-enabled/*;
}
<% if @mail -%>
mail {
include <%= @conf_dir %>/conf.mail.d/*.conf;
}
<% end -%>