diff --git a/manifests/config.pp b/manifests/config.pp index acae8de44..fb3ed4bb9 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -16,6 +16,7 @@ class nginx::config( $worker_processes = $nginx::params::nx_worker_processes, $worker_connections = $nginx::params::nx_worker_connections, + $worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile, $confd_purge = $nginx::params::nx_confd_purge, $vhost_purge = $nginx::params::nx_vhost_purge, $server_tokens = $nginx::params::nx_server_tokens, diff --git a/manifests/init.pp b/manifests/init.pp index 647fc58b5..19576057c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -31,6 +31,7 @@ class nginx ( $worker_processes = $nginx::params::nx_worker_processes, $worker_connections = $nginx::params::nx_worker_connections, + $worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile, $package_name = $nginx::params::package_name, $package_ensure = $nginx::params::package_ensure, $package_source = $nginx::params::package_source, @@ -71,6 +72,9 @@ if (!is_integer($worker_connections)) { fail('$worker_connections must be an integer.') } + if (!is_integer($worker_rlimit_nofile)) { + fail('$worker_rlimit_nofile must be an integer.') + } validate_string($package_name) validate_string($package_ensure) validate_string($package_source) @@ -121,6 +125,7 @@ class { 'nginx::config': worker_processes => $worker_processes, worker_connections => $worker_connections, + worker_rlimit_nofile => $worker_rlimit_nofile, proxy_set_header => $proxy_set_header, proxy_http_version => $proxy_http_version, proxy_cache_path => $proxy_cache_path, diff --git a/manifests/params.pp b/manifests/params.pp index 1122d4283..57d11f1fd 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,6 +27,7 @@ $nx_vhost_purge = false $nx_worker_processes = 1 $nx_worker_connections = 1024 + $nx_worker_rlimit_nofile = 1024 $nx_types_hash_max_size = 1024 $nx_types_hash_bucket_size = 512 $nx_names_hash_bucket_size = 64 diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 6ebb53138..6076e5481 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -161,6 +161,12 @@ :value => '4', :match => 'worker_processes 4;', }, + { + :title => 'should set worker_rlimit_nofile', + :attr => 'worker_rlimit_nofile', + :value => '10000', + :match => 'worker_rlimit_nofile 10000;', + }, { :title => 'should set error_log', :attr => 'nginx_error_log', diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 1b8502e5c..68437865b 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -1,5 +1,6 @@ user <%= scope.lookupvar('nginx::config::nx_daemon_user') %>; worker_processes <%= @worker_processes %>; +worker_rlimit_nofile <%= @worker_rlimit_nofile %>; error_log <%= @nginx_error_log %>; pid <%= scope.lookupvar('nginx::params::nx_pid')%>;