2016-02-03 04:35:18 +01:00
|
|
|
# MANAGED BY PUPPET
|
2014-05-15 14:51:37 +02:00
|
|
|
<% if @super_user -%>
|
|
|
|
user <%= @daemon_user %>;
|
|
|
|
<% end -%>
|
2013-07-17 20:42:57 +02:00
|
|
|
worker_processes <%= @worker_processes %>;
|
2014-09-12 19:42:51 +02:00
|
|
|
<% if @worker_rlimit_nofile -%>
|
|
|
|
worker_rlimit_nofile <%= @worker_rlimit_nofile %>;
|
|
|
|
<% end -%>
|
2011-06-07 00:25:04 +02:00
|
|
|
|
2014-03-07 15:52:38 +01:00
|
|
|
<% if @pid -%>
|
|
|
|
pid <%= @pid %>;
|
|
|
|
<% end -%>
|
2015-11-01 14:14:08 +01:00
|
|
|
error_log <%= @nginx_error_log %> <%= @nginx_error_log_severity %>;
|
2011-06-07 00:25:04 +02:00
|
|
|
|
2014-12-26 17:54:26 +01:00
|
|
|
<% if @nginx_cfg_prepend -%>
|
2014-12-26 18:16:12 +01:00
|
|
|
<%- 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 -%>
|
2014-12-26 17:54:26 +01:00
|
|
|
<% end -%>
|
|
|
|
|
2011-06-07 00:25:04 +02:00
|
|
|
events {
|
2016-01-26 04:41:06 +01:00
|
|
|
accept_mutex <%= @accept_mutex %>;
|
|
|
|
<%- if @accept_mutex_delay -%>
|
|
|
|
accept_mutex_delay <%= @accept_mutex_delay %>;
|
|
|
|
<%- end -%>
|
2014-06-10 23:10:00 +02:00
|
|
|
worker_connections <%= @worker_connections -%>;
|
2014-09-12 19:42:51 +02:00
|
|
|
<%- if @multi_accept == 'on' -%>
|
2014-05-31 16:06:23 +02:00
|
|
|
multi_accept on;
|
2014-09-12 19:42:51 +02:00
|
|
|
<%- end -%>
|
|
|
|
<%- if @events_use -%>
|
2014-05-31 16:06:23 +02:00
|
|
|
use <%= @events_use %>;
|
2014-09-12 19:42:51 +02:00
|
|
|
<%- end -%>
|
2011-06-07 00:25:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2014-06-13 12:15:42 +02:00
|
|
|
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
|
|
|
|
2013-08-08 03:27:13 +02:00
|
|
|
access_log <%= @http_access_log %>;
|
2011-06-07 00:25:04 +02:00
|
|
|
|
2014-03-07 15:52:38 +01:00
|
|
|
<% if @sendfile == 'on' -%>
|
|
|
|
sendfile on;
|
2014-09-12 19:42:51 +02:00
|
|
|
<%- if @http_tcp_nopush == 'on' -%>
|
2014-03-07 15:52:38 +01:00
|
|
|
tcp_nopush on;
|
2014-09-12 19:42:51 +02:00
|
|
|
<%- end -%>
|
2014-03-07 15:52:38 +01:00
|
|
|
<% 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
|
|
|
|
2014-03-07 15:52:38 +01: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
|
|
|
|
2014-01-10 04:42:16 +01:00
|
|
|
server_names_hash_bucket_size <%= @names_hash_bucket_size %>;
|
|
|
|
server_names_hash_max_size <%= @names_hash_max_size %>;
|
2013-06-20 16:48:52 +02:00
|
|
|
|
2014-03-07 15:52:38 +01:00
|
|
|
keepalive_timeout <%= @keepalive_timeout %>;
|
|
|
|
tcp_nodelay <%= @http_tcp_nodelay %>;
|
2011-06-07 00:25:04 +02:00
|
|
|
|
2014-03-07 15:52:38 +01:00
|
|
|
<% if @gzip == 'on' -%>
|
2015-07-11 22:28:43 +02:00
|
|
|
gzip on;
|
|
|
|
<% if @gzip_buffers -%>
|
|
|
|
gzip_buffers <%= @gzip_buffers %>;
|
|
|
|
<% end -%>
|
|
|
|
gzip_comp_level <%= @gzip_comp_level %>;
|
|
|
|
<% if @gzip_disable -%>
|
|
|
|
gzip_disable <%= @gzip_disable %>;
|
|
|
|
<% end -%>
|
|
|
|
gzip_min_length <%= @gzip_min_length %>;
|
|
|
|
gzip_http_version <%= @gzip_http_version %>;
|
|
|
|
<% if @gzip_proxied -%>
|
|
|
|
gzip_proxied <%= @gzip_proxied %>;
|
2013-03-27 19:13:52 +01:00
|
|
|
<% end -%>
|
2016-02-08 22:25:25 +01:00
|
|
|
<% if @gzip_types -%>
|
2015-07-11 22:28:43 +02:00
|
|
|
gzip_types <%= @gzip_types.kind_of?(Array) ? @gzip_types.join(' ') : @gzip_types %>;
|
2016-02-08 22:25:25 +01:00
|
|
|
<% end -%>
|
2015-07-11 22:28:43 +02:00
|
|
|
gzip_vary <%= @gzip_vary %>;
|
|
|
|
<% end -%>
|
|
|
|
|
2015-06-12 15:25:26 +02:00
|
|
|
<% if @client_body_temp_path -%>
|
|
|
|
client_body_temp_path <%= @client_body_temp_path %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @client_max_body_size -%>
|
|
|
|
client_max_body_size <%= @client_max_body_size %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @client_body_buffer_size -%>
|
|
|
|
client_body_buffer_size <%= @client_body_buffer_size %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_redirect -%>
|
|
|
|
proxy_redirect <%= @proxy_redirect %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_temp_path -%>
|
|
|
|
proxy_temp_path <%= @proxy_temp_path %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_connect_timeout -%>
|
|
|
|
proxy_connect_timeout <%= @proxy_connect_timeout %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_send_timeout -%>
|
|
|
|
proxy_send_timeout <%= @proxy_send_timeout %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_read_timeout -%>
|
|
|
|
proxy_read_timeout <%= @proxy_read_timeout %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_buffers -%>
|
|
|
|
proxy_buffers <%= @proxy_buffers %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_buffer_size -%>
|
|
|
|
proxy_buffer_size <%= @proxy_buffer_size %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @proxy_http_version -%>
|
|
|
|
proxy_http_version <%= @proxy_http_version %>;
|
|
|
|
<% end -%>
|
|
|
|
<% @proxy_set_header.each do |header| -%>
|
|
|
|
proxy_set_header <%= header %>;
|
|
|
|
<% end -%>
|
2016-05-12 18:09:16 +02:00
|
|
|
<% @proxy_hide_header.each do |header| -%>
|
|
|
|
proxy_hide_header <%= header %>;
|
|
|
|
<% end -%>
|
2015-06-12 15:25:26 +02:00
|
|
|
<% if @proxy_headers_hash_bucket_size -%>
|
|
|
|
proxy_headers_hash_bucket_size <%= @proxy_headers_hash_bucket_size %>;
|
|
|
|
<% end -%>
|
2015-06-03 23:41:56 +02:00
|
|
|
<% if @proxy_cache_path.is_a?(Hash) -%>
|
2015-06-02 19:48:57 +02:00
|
|
|
<% @proxy_cache_path.sort_by{|k,v| k}.each do |key,value| -%>
|
|
|
|
proxy_cache_path <%= key %> keys_zone=<%= value %> levels=<%= @proxy_cache_levels %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>;
|
|
|
|
<% end -%>
|
|
|
|
<% elsif @proxy_cache_path -%>
|
2014-09-12 19:42:51 +02:00
|
|
|
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 %>;
|
|
|
|
<% end -%>
|
2014-04-26 16:34:29 +02:00
|
|
|
<% if @fastcgi_cache_path -%>
|
2014-04-27 15:49:45 +02:00
|
|
|
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 -%>
|
2014-09-12 19:42:51 +02:00
|
|
|
fastcgi_cache_key <%= @fastcgi_cache_key %>;
|
2014-04-27 15:49:45 +02:00
|
|
|
<% end -%>
|
|
|
|
<% if @fastcgi_cache_use_stale -%>
|
2014-09-12 19:42:51 +02:00
|
|
|
fastcgi_cache_use_stale <%= @fastcgi_cache_use_stale %>;
|
2014-04-26 16:34:29 +02:00
|
|
|
<% end -%>
|
2014-09-12 19:42:51 +02:00
|
|
|
<% if @http_cfg_append -%>
|
2014-04-26 16:34:29 +02:00
|
|
|
|
2014-09-12 19:42:51 +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 -%>
|
2014-09-12 19:42:51 +02:00
|
|
|
<%- end -%>
|
2013-07-21 02:12:18 +02:00
|
|
|
<% end -%>
|
|
|
|
|
2014-06-13 12:15:42 +02:00
|
|
|
include <%= @conf_dir %>/conf.d/*.conf;
|
|
|
|
include <%= @conf_dir %>/sites-enabled/*;
|
2012-10-01 21:00:18 +02:00
|
|
|
}
|
2014-03-07 15:52:38 +01:00
|
|
|
<% if @mail -%>
|
add support for mail module
See http://wiki.nginx.org/Modules#Mail_modules
Sample Usage:
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'server2.example/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl_port => 465,
starttls => 'only',
xclient => 'off',
ssl => 'true',
ssl_cert => '/tmp/server.crt',
ssl_key => '/tmp/server.pem',
}
2013-03-11 14:05:00 +01:00
|
|
|
mail {
|
2014-06-13 12:15:42 +02:00
|
|
|
include <%= @conf_dir %>/conf.mail.d/*.conf;
|
add support for mail module
See http://wiki.nginx.org/Modules#Mail_modules
Sample Usage:
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'server2.example/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl_port => 465,
starttls => 'only',
xclient => 'off',
ssl => 'true',
ssl_cert => '/tmp/server.crt',
ssl_key => '/tmp/server.pem',
}
2013-03-11 14:05:00 +01:00
|
|
|
}
|
|
|
|
<% end -%>
|
2015-10-02 20:41:28 +02:00
|
|
|
<% if @stream -%>
|
|
|
|
stream {
|
|
|
|
include <%= @conf_dir %>/conf.stream.d/*.conf;
|
|
|
|
}
|
|
|
|
<% end -%>
|