Merge pull request #96 from abraham1901/dev

Adding option http_cfg_append to class nginx
This commit is contained in:
James Fryman 2013-07-21 11:30:02 -07:00
commit 17d1edaf74
4 changed files with 22 additions and 7 deletions

View file

@ -26,7 +26,8 @@ class nginx::config(
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive, $proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
$proxy_http_version = $nginx::params::nx_proxy_http_version, $proxy_http_version = $nginx::params::nx_proxy_http_version,
$types_hash_max_size = $nginx::params::nx_types_hash_max_size, $types_hash_max_size = $nginx::params::nx_types_hash_max_size,
$types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size $types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size,
$http_cfg_append = $nginx::params::nx_http_cfg_append
) inherits nginx::params { ) inherits nginx::params {
File { File {
owner => 'root', owner => 'root',

View file

@ -43,6 +43,7 @@ class nginx (
$service_restart = $nginx::params::nx_service_restart, $service_restart = $nginx::params::nx_service_restart,
$mail = $nginx::params::nx_mail, $mail = $nginx::params::nx_mail,
$server_tokens = $nginx::params::nx_server_tokens, $server_tokens = $nginx::params::nx_server_tokens,
$http_cfg_append = $nginx::params::nx_http_cfg_append,
$nginx_vhosts = {}, $nginx_vhosts = {},
$nginx_upstreams = {}, $nginx_upstreams = {},
$nginx_locations = {}, $nginx_locations = {},
@ -66,6 +67,7 @@ class nginx (
proxy_cache_inactive => $proxy_cache_inactive, proxy_cache_inactive => $proxy_cache_inactive,
confd_purge => $confd_purge, confd_purge => $confd_purge,
server_tokens => $server_tokens, server_tokens => $server_tokens,
http_cfg_append => $http_cfg_append,
require => Class['nginx::package'], require => Class['nginx::package'],
notify => Class['nginx::service'], notify => Class['nginx::service'],
} }

View file

@ -25,7 +25,9 @@ class nginx::params {
$nx_types_hash_bucket_size = 512 $nx_types_hash_bucket_size = 512
$nx_names_hash_bucket_size = 64 $nx_names_hash_bucket_size = 64
$nx_multi_accept = off $nx_multi_accept = off
$nx_events_use = false # One of [kqueue|rtsig|epoll|/dev/poll|select|poll|eventport] or false to use OS default # One of [kqueue|rtsig|epoll|/dev/poll|select|poll|eventport]
# or false to use OS default
$nx_events_use = false
$nx_sendfile = on $nx_sendfile = on
$nx_keepalive_timeout = 65 $nx_keepalive_timeout = 65
$nx_tcp_nodelay = on $nx_tcp_nodelay = on
@ -70,12 +72,16 @@ class nginx::params {
/(?i-mx:fedora|rhel|redhat|centos|scientific|suse|opensuse|amazon|gentoo)/ => 'nginx', /(?i-mx:fedora|rhel|redhat|centos|scientific|suse|opensuse|amazon|gentoo)/ => 'nginx',
} }
# Service restart after Nginx 0.7.53 could also be just "/path/to/nginx/bin -s HUP" # Service restart after Nginx 0.7.53 could also be just
# Some init scripts do a configtest, some don't. If configtest_enable it's true # "/path/to/nginx/bin -s HUP" Some init scripts do a configtest, some don't.
# then service restart will take $nx_service_restart value, forcing configtest. # If configtest_enable it's true then service restart will take
# $nx_service_restart value, forcing configtest.
$nx_configtest_enable = false $nx_configtest_enable = false
$nx_service_restart = '/etc/init.d/nginx configtest && /etc/init.d/nginx restart' $nx_service_restart = '/etc/init.d/nginx configtest && /etc/init.d/nginx restart'
$nx_mail = false $nx_mail = false
$nx_http_cfg_append = false
} }

View file

@ -29,16 +29,22 @@ http {
keepalive_timeout <%= scope.lookupvar('nginx::params::nx_keepalive_timeout')%>; keepalive_timeout <%= scope.lookupvar('nginx::params::nx_keepalive_timeout')%>;
tcp_nodelay <%= scope.lookupvar('nginx::params::nx_tcp_nodelay')%>; tcp_nodelay <%= scope.lookupvar('nginx::params::nx_tcp_nodelay')%>;
<% if scope.lookupvar('nginx::params::nx_gzip') == 'on' %> <% if scope.lookupvar('nginx::params::nx_gzip') == 'on' %>
gzip on; gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_disable "MSIE [1-6]\.(?!.*SV1)";
<% end -%> <% end -%>
<% if @proxy_cache_path -%> <% 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 %>; 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 -%> <% end -%>
<% if @http_cfg_append -%><% @http_cfg_append.sort_by{|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%>
<% end -%>
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
} }
<% if scope.lookupvar('nginx::mail') %> <% if scope.lookupvar('nginx::mail') %>
mail { mail {