From 94e87d86cd1b691ba09e61f6056e1e90824d5b0c Mon Sep 17 00:00:00 2001 From: Todd Eddy Date: Tue, 6 Aug 2013 20:40:21 -0400 Subject: [PATCH 1/8] Allow user modification of access and error log in vhost. --- manifests/resource/vhost.pp | 25 ++++++++++++++++++++++++- templates/vhost/vhost_header.erb | 4 ++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 588f052..03c80a2 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -46,6 +46,8 @@ # [*rewrite_to_https*] - Adds a server directive and rewrite rule to # rewrite to ssl # [*include_files*] - Adds include files to vhost +# [*access_log*] - Full path where to write access log, or off +# [*error_log*] - Full path where to write error log, or off # # Actions: # @@ -98,7 +100,9 @@ define nginx::resource::vhost ( $auth_basic = undef, $auth_basic_user_file = undef, $vhost_cfg_append = undef, - $include_files = undef + $include_files = undef, + $access_log = undef, + $error_log = undef, ) { File { @@ -125,6 +129,25 @@ define nginx::resource::vhost ( } } + # This was a lot to add up in parameter list so add it down here + # Also opted to add more logic here and keep template cleaner which + # unfortunately means resorting to the $varname_real thing + $domain_log_name = regsubst($name, ' ', '_') + $access_log_real = $access_log ? { + undef => "${nginx::params::nx_logdir}/${domain_log_name}.access.log", + default => $access_log, + } + if ($access_log_real != 'off') { + validate_absolute_path($access_log_real) + } + $error_log_real = $error_log ? { + undef => "${nginx::params::nx_logdir}/${domain_log_name}.error.log", + default => $error_log, + } + if ($error_log_real != 'off') { + validate_absolute_path($error_log_real) + } + # Use the File Fragment Pattern to construct the configuration files. # Create the base configuration file reference. if ($listen_port != $ssl_port) { diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index e4d966f..e1fcb85 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -20,6 +20,6 @@ server { } <% end -%> - access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= @name.gsub(' ', '_') %>.access.log; - error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= @name.gsub(' ', '_') %>.error.log; + access_log <%= @access_log_real %>; + error_log <%= @error_log_real %>; From c6cd476c82b6b616ce84e46f87a21b8ec87d52a8 Mon Sep 17 00:00:00 2001 From: Todd Eddy Date: Wed, 7 Aug 2013 09:59:44 -0400 Subject: [PATCH 2/8] Add custom logs to ssl vhosts as well. --- manifests/resource/vhost.pp | 15 +++++++++++++++ templates/vhost/vhost_ssl_header.erb | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 03c80a2..b001b80 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -212,6 +212,21 @@ define nginx::resource::vhost ( # Create SSL File Stubs if SSL is enabled if ($ssl == true) { + # Access and error logs are named differently in ssl template + $ssl_access_log = $access_log ? { + undef => "${nginx::params::nx_logdir}/ssl-${domain_log_name}.access.log", + default => $access_log, + } + if ($ssl_access_log != 'off') { + validate_absolute_path($ssl_access_log) + } + $ssl_error_log = $error_log ? { + undef => "${nginx::params::nx_logdir}/ssl-${domain_log_name}.error.log", + default => $error_log, + } + if ($ssl_error_log != 'off') { + validate_absolute_path($ssl_error_log) + } file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl": ensure => $ensure ? { 'absent' => absent, diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index 1172df1..bca6644 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -21,5 +21,5 @@ server { auth_basic_user_file <%= @auth_basic_user_file %>; <% end -%> - access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/ssl-<%= @name.gsub(' ', '_') %>.access.log; - error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/ssl-<%= @name.gsub(' ', '_') %>.error.log; + access_log <%= @ssl_access_log %>; + error_log <%= @ssl_error_log %>; From 8cb8a31ade796fcc0b67042d30f685dcd1be63ab Mon Sep 17 00:00:00 2001 From: Todd Eddy Date: Wed, 7 Aug 2013 10:19:46 -0400 Subject: [PATCH 3/8] Removed path checking to allow additional logging options. --- manifests/resource/vhost.pp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index b001b80..5c1a14f 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -46,8 +46,10 @@ # [*rewrite_to_https*] - Adds a server directive and rewrite rule to # rewrite to ssl # [*include_files*] - Adds include files to vhost -# [*access_log*] - Full path where to write access log, or off -# [*error_log*] - Full path where to write error log, or off +# [*access_log*] - Where to write access log. May add additional +# options like log format to the end. +# [*error_log*] - Where to write error log. May add additional +# options like error level to the end. # # Actions: # @@ -137,16 +139,10 @@ define nginx::resource::vhost ( undef => "${nginx::params::nx_logdir}/${domain_log_name}.access.log", default => $access_log, } - if ($access_log_real != 'off') { - validate_absolute_path($access_log_real) - } $error_log_real = $error_log ? { undef => "${nginx::params::nx_logdir}/${domain_log_name}.error.log", default => $error_log, } - if ($error_log_real != 'off') { - validate_absolute_path($error_log_real) - } # Use the File Fragment Pattern to construct the configuration files. # Create the base configuration file reference. @@ -217,16 +213,10 @@ define nginx::resource::vhost ( undef => "${nginx::params::nx_logdir}/ssl-${domain_log_name}.access.log", default => $access_log, } - if ($ssl_access_log != 'off') { - validate_absolute_path($ssl_access_log) - } $ssl_error_log = $error_log ? { undef => "${nginx::params::nx_logdir}/ssl-${domain_log_name}.error.log", default => $error_log, } - if ($ssl_error_log != 'off') { - validate_absolute_path($ssl_error_log) - } file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl": ensure => $ensure ? { 'absent' => absent, From 70207c9a6563c87823fa93ce4d87942e3a609fb8 Mon Sep 17 00:00:00 2001 From: Todd Eddy Date: Wed, 7 Aug 2013 21:27:13 -0400 Subject: [PATCH 4/8] Add logging customization to the main logs as well. --- manifests/config.pp | 4 +++- manifests/init.pp | 4 ++++ manifests/params.pp | 3 +++ templates/conf.d/nginx.conf.erb | 4 ++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 000afbe..0abb55c 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -27,7 +27,9 @@ class nginx::config( $proxy_http_version = $nginx::params::nx_proxy_http_version, $types_hash_max_size = $nginx::params::nx_types_hash_max_size, $types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size, - $http_cfg_append = $nginx::params::nx_http_cfg_append + $http_cfg_append = $nginx::params::nx_http_cfg_append, + $nginx_error_log = $nginx::params::nx_nginx_error_log, + $http_access_log = $nginx::params::nx_http_access_log, ) inherits nginx::params { File { owner => 'root', diff --git a/manifests/init.pp b/manifests/init.pp index 49651fd..3e6286e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,6 +44,8 @@ class nginx ( $mail = $nginx::params::nx_mail, $server_tokens = $nginx::params::nx_server_tokens, $http_cfg_append = $nginx::params::nx_http_cfg_append, + $nginx_error_log = $nginx::params::nx_nginx_error_log, + $http_access_log = $nginx::params::nx_http_access_log, $nginx_vhosts = {}, $nginx_upstreams = {}, $nginx_locations = {}, @@ -68,6 +70,8 @@ class nginx ( confd_purge => $confd_purge, server_tokens => $server_tokens, http_cfg_append => $http_cfg_append, + nginx_error_log => $nginx_error_log, + http_access_log => $http_access_log, require => Class['nginx::package'], notify => Class['nginx::service'], } diff --git a/manifests/params.pp b/manifests/params.pp index 4e3bf0b..aed8889 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -84,4 +84,7 @@ class nginx::params { $nx_http_cfg_append = false + $nx_nginx_error_log = "${nx_logdir}/error.log" + $nx_http_access_log = "${nx_logdir}/access.log" + } diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 06f6840..5c38de8 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -1,7 +1,7 @@ user <%= scope.lookupvar('nginx::config::nx_daemon_user') %>; worker_processes <%= @worker_processes %>; -error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/error.log; +error_log <%= @nginx_error_log %>; pid <%= scope.lookupvar('nginx::params::nx_pid')%>; events { @@ -14,7 +14,7 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; - access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/access.log; + access_log <%= @http_access_log %>; sendfile <%= scope.lookupvar('nginx::params::nx_sendfile')%>; From b8189496a3dafe55dffa5a60d53ff1051403f5e6 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Fri, 16 Aug 2013 16:29:05 -0700 Subject: [PATCH 5/8] sort $vhost_cfg_append hash in vhost_footer.erb template This is so the paremter ordering in the configuration is stable. It also force the :allow key (if it exists) to be first in the sort ordering. It would probably be better to change `$vhost_cfg_append` into an array of one key hashes but would require a public API change. --- templates/vhost/vhost_footer.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/vhost/vhost_footer.erb b/templates/vhost/vhost_footer.erb index 72b85b1..4b34507 100644 --- a/templates/vhost/vhost_footer.erb +++ b/templates/vhost/vhost_footer.erb @@ -1,7 +1,10 @@ <% if @include_files %><% @include_files.each do |file| -%> include <%= file %>; <% end -%><% end -%> -<% if @vhost_cfg_append -%><% vhost_cfg_append.each do |key,value| -%> +<%# make sure that allow comes before deny by forcing the allow key (if it -%> +<%# exists) to be first in the output order. The hash keys also need to be -%> +<%# sorted so that the ordering is stable. -%> +<% if @vhost_cfg_append -%><% vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <%= key %> <%= value %>; <% end -%> <% end -%> From f609f9601d3ede914d62dc8d0d9bb879b5ccd841 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 22 Aug 2013 23:02:04 +0400 Subject: [PATCH 6/8] Adding option http_cfg_prepend to class nginx --- manifests/resource/vhost.pp | 5 ++++- templates/vhost/vhost_header.erb | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 844fff3..084b690 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -43,6 +43,8 @@ # the authentication realm. # [*vhost_cfg_append*] - It expects a hash with custom directives to # put after everything else inside vhost +# [*vhost_cfg_prepend*] - It expects a hash with custom directives to +# put before everything else inside vhost # [*rewrite_to_https*] - Adds a server directive and rewrite rule to # rewrite to ssl # [*include_files*] - Adds include files to vhost @@ -101,6 +103,7 @@ define nginx::resource::vhost ( $try_files = undef, $auth_basic = undef, $auth_basic_user_file = undef, + $vhost_cfg_prepend = undef, $vhost_cfg_append = undef, $include_files = undef, $access_log = undef, @@ -134,7 +137,7 @@ define nginx::resource::vhost ( # This was a lot to add up in parameter list so add it down here # Also opted to add more logic here and keep template cleaner which # unfortunately means resorting to the $varname_real thing - $domain_log_name = regsubst($name, ' ', '_') + $domain_log_name = regsubst($name, ' ', '_', 'G') $access_log_real = $access_log ? { undef => "${nginx::params::nx_logdir}/${domain_log_name}.access.log", default => $access_log, diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index e1fcb85..ea6fb8a 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -11,6 +11,12 @@ server { <% if defined? auth_basic_user_file -%> auth_basic_user_file <%= @auth_basic_user_file %>; <% end -%> +<%# make sure that allow comes before deny by forcing the allow key (if it -%> +<%# exists) to be first in the output order. The hash keys also need to be -%> +<%# sorted so that the ordering is stable. -%> +<% if @vhost_cfg_prepend -%><% vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> + <%= key %> <%= value %>; +<% end -%> <% @proxy_set_header.each do |header| -%> proxy_set_header <%= header %>; <% end -%> From eb73601aace20d668b6bac033fc1e907ff0a2c7b Mon Sep 17 00:00:00 2001 From: root Date: Thu, 22 Aug 2013 23:23:16 +0400 Subject: [PATCH 7/8] Fix puppet-lint --- manifests/package/redhat.pp | 2 +- manifests/resource/location.pp | 55 +++++++++++++++++---------- manifests/resource/vhost.pp | 68 ++++++++++++++++++++++------------ 3 files changed, 81 insertions(+), 44 deletions(-) diff --git a/manifests/package/redhat.pp b/manifests/package/redhat.pp index 85fda93..f70d5b9 100644 --- a/manifests/package/redhat.pp +++ b/manifests/package/redhat.pp @@ -34,7 +34,7 @@ class nginx::package::redhat { enabled => '1', gpgcheck => '1', priority => '1', - gpgkey => "http://nginx.org/keys/nginx_signing.key", + gpgkey => "http://nginx.org/keys/nginx_signing.key", } #Define file for nginx-repo so puppet doesn't delete it diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 8f2c7c8..098faf7 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -3,25 +3,42 @@ # This definition creates a new location entry within a virtual host # # Parameters: -# [*ensure*] - Enables or disables the specified location (present|absent) -# [*vhost*] - Defines the default vHost for this location entry to include with -# [*location*] - Specifies the URI associated with this location entry -# [*www_root*] - Specifies the location on disk for files to be read from. Cannot be set in conjunction with $proxy -# [*index_files*] - Default index files for NGINX to read when traversing a directory -# [*proxy*] - Proxy server(s) for a location to connect to. Accepts a single value, can be used in conjunction -# with nginx::resource::upstream -# [*proxy_read_timeout*] - Override the default the proxy read timeout value of 90 seconds +# [*ensure*] - Enables or disables the specified location +# (present|absent) +# [*vhost*] - Defines the default vHost for this location +# entry to include with +# [*location*] - Specifies the URI associated with this location +# entry +# [*www_root*] - Specifies the location on disk for files to be +# read from. Cannot be set in conjunction with $proxy +# [*index_files*] - Default index files for NGINX to read when +# traversing a directory +# [*proxy*] - Proxy server(s) for a location to connect to. +# Accepts a single value, can be used in conjunction with +# nginx::resource::upstream +# [*proxy_read_timeout*] - Override the default the proxy read timeout +# value of 90 seconds # [*fastcgi*] - location of fastcgi (host:port) -# [*fastcgi_params*] - optional alternative fastcgi_params file to use -# [*fastcgi_script*] - optional SCRIPT_FILE parameter -# [*fastcgi_split_path*] - Allows settings of fastcgi_split_path_info so that you can split the script_name and path_info via regex -# [*ssl*] - Indicates whether to setup SSL bindings for this location. -# [*ssl_only*] - Required if the SSL and normal vHost have the same port. -# [*location_alias*] - Path to be used as basis for serving requests for this location -# [*stub_status*] - If true it will point configure module stub_status to provide nginx stats on location -# [*location_custom_cfg*] - Expects a hash with custom directives, cannot be used with other location types (proxy, fastcgi, root, or stub_status) -# [*location_cfg_prepend*] - Expects a hash with extra directives to put before anything else inside location (used with all other types except custom_cfg) -# [*location_cfg_append*] - Expects a hash with extra directives to put after everything else inside location (used with all other types except custom_cfg) +# [*fastcgi_params*] - optional alternative fastcgi_params file to use +# [*fastcgi_script*] - optional SCRIPT_FILE parameter +# [*fastcgi_split_path*] - Allows settings of fastcgi_split_path_info so +# that you can split the script_name and path_info via regex +# [*ssl*] - Indicates whether to setup SSL bindings for +# this location. +# [*ssl_only*] - Required if the SSL and normal vHost have the +# same port. +# [*location_alias*] - Path to be used as basis for serving requests +# for this location +# [*stub_status*] - If true it will point configure module +# stub_status to provide nginx stats on location +# [*location_custom_cfg*] - Expects a hash with custom directives, cannot +# be used with other location types (proxy, fastcgi, root, or stub_status) +# [*location_cfg_prepend*] - Expects a hash with extra directives to put +# before anything else inside location (used with all other types except +# custom_cfg) +# [*location_cfg_append*] - Expects a hash with extra directives to put +# after everything else inside location (used with all other types except +# custom_cfg) # [*try_files*] - An array of file locations to try # [*option*] - Reserved for future use # [*proxy_cache*] - This directive sets name of zone for caching. @@ -133,7 +150,7 @@ define nginx::resource::location ( $content_real = template('nginx/vhost/vhost_location_empty.erb') } - if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) { + if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) { file { '/etc/nginx/fastcgi_params': ensure => present, mode => '0770', diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 084b690..664dca5 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -3,34 +3,54 @@ # This definition creates a virtual host # # Parameters: -# [*ensure*] - Enables or disables the specified vhost (present|absent) -# [*listen_ip*] - Default IP Address for NGINX to listen with this vHost on. Defaults to all interfaces (*) -# [*listen_port*] - Default IP Port for NGINX to listen with this vHost on. Defaults to TCP 80 -# [*listen_options*] - Extra options for listen directive like 'default' to catchall. Undef by default. -# [*ipv6_enable*] - BOOL value to enable/disable IPv6 support (false|true). Module will check to see if IPv6 -# support exists on your system before enabling. -# [*ipv6_listen_ip*] - Default IPv6 Address for NGINX to listen with this vHost on. Defaults to all interfaces (::) -# [*ipv6_listen_port*] - Default IPv6 Port for NGINX to listen with this vHost on. Defaults to TCP 80 -# [*ipv6_listen_options*] - Extra options for listen directive like 'default' to catchall. Template will allways add ipv6only=on. -# While issue jfryman/puppet-nginx#30 is discussed, default value is 'default'. -# [*index_files*] - Default index files for NGINX to read when traversing a directory -# [*proxy*] - Proxy server(s) for the root location to connect to. Accepts a single value, can be used in -# conjunction with nginx::resource::upstream -# [*proxy_read_timeout*] - Override the default the proxy read timeout value of 90 seconds +# [*ensure*] - Enables or disables the specified vhost +# (present|absent) +# [*listen_ip*] - Default IP Address for NGINX to listen with this +# vHost on. Defaults to all interfaces (*) +# [*listen_port*] - Default IP Port for NGINX to listen with this +# vHost on. Defaults to TCP 80 +# [*listen_options*] - Extra options for listen directive like +# 'default' to catchall. Undef by default. +# [*ipv6_enable*] - BOOL value to enable/disable IPv6 support +# (false|true). Module will check to see if IPv6 support exists on your +# system before enabling. +# [*ipv6_listen_ip*] - Default IPv6 Address for NGINX to listen with +# this vHost on. Defaults to all interfaces (::) +# [*ipv6_listen_port*] - Default IPv6 Port for NGINX to listen with this +# vHost on. Defaults to TCP 80 +# [*ipv6_listen_options*] - Extra options for listen directive like 'default' +# to catchall. Template will allways add ipv6only=on. While issue +# jfryman/puppet-nginx#30 is discussed, default value is 'default'. +# [*index_files*] - Default index files for NGINX to read when +# traversing a directory +# [*proxy*] - Proxy server(s) for the root location to connect +# to. Accepts a single value, can be used in conjunction with +# nginx::resource::upstream +# [*proxy_read_timeout*] - Override the default the proxy read timeout value +# of 90 seconds # [*fastcgi*] - location of fastcgi (host:port) # [*fastcgi_params*] - optional alternative fastcgi_params file to use # [*fastcgi_script*] - optional SCRIPT_FILE parameter -# [*ssl*] - Indicates whether to setup SSL bindings for this vhost. -# [*ssl_cert*] - Pre-generated SSL Certificate file to reference for SSL Support. This is not generated by this module. -# [*ssl_key*] - Pre-generated SSL Key file to reference for SSL Support. This is not generated by this module. -# [*ssl_port*] - Default IP Port for NGINX to listen with this SSL vHost on. Defaults to TCP 443 -# [*ssl_protocols*] - SSL protocols enabled. Defaults to 'SSLv3 TLSv1 TLSv1.1 TLSv1.2'. -# [*ssl_ciphers*] - SSL ciphers enabled. Defaults to 'HIGH:!aNULL:!MD5'. +# [*ssl*] - Indicates whether to setup SSL bindings for this +# vhost. +# [*ssl_cert*] - Pre-generated SSL Certificate file to reference +# for SSL Support. This is not generated by this module. +# [*ssl_key*] - Pre-generated SSL Key file to reference for SSL +# Support. This is not generated by this module. +# [*ssl_port*] - Default IP Port for NGINX to listen with this SSL +# vHost on. Defaults to TCP 443 +# [*ssl_protocols*] - SSL protocols enabled. Defaults to 'SSLv3 TLSv1 +# TLSv1.1 TLSv1.2'. +# [*ssl_ciphers*] - SSL ciphers enabled. Defaults to +# 'HIGH:!aNULL:!MD5'. # [*spdy*] - Toggles SPDY protocol. -# [*server_name*] - List of vhostnames for which this vhost will respond. Default [$name]. -# [*www_root*] - Specifies the location on disk for files to be read from. Cannot be set in conjunction with $proxy +# [*server_name*] - List of vhostnames for which this vhost will +# respond. Default [$name]. +# [*www_root*] - Specifies the location on disk for files to be +# read from. Cannot be set in conjunction with $proxy # [*rewrite_www_to_non_www*] - Adds a server directive and rewrite rule to -# rewrite www.domain.com to domain.com in order to avoid duplicate content (SEO); +# rewrite www.domain.com to domain.com in order to avoid duplicate +# content (SEO); # [*try_files*] - Specifies the locations for files to be # checked as an array. Cannot be used in conjuction with $proxy. # [*proxy_cache*] - This directive sets name of zone for caching. @@ -196,7 +216,7 @@ define nginx::resource::vhost ( location_cfg_append => $location_cfg_append } } - if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) { + if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) { file { '/etc/nginx/fastcgi_params': ensure => present, mode => '0770', From 4f27265047492db6e328ee249b665ef355eb13d9 Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Thu, 5 Sep 2013 11:43:44 +0400 Subject: [PATCH 8/8] remove each_line --- templates/vhost/vhost_footer.erb | 4 ++-- templates/vhost/vhost_header.erb | 4 ++-- templates/vhost/vhost_location_directory.erb | 4 ++-- templates/vhost/vhost_location_fastcgi.erb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/vhost/vhost_footer.erb b/templates/vhost/vhost_footer.erb index 0af9cc5..0f70a7d 100644 --- a/templates/vhost/vhost_footer.erb +++ b/templates/vhost/vhost_footer.erb @@ -1,10 +1,10 @@ -<% if @include_files %><% @include_files.each_line do |file| -%> +<% if @include_files %><% @include_files.each do |file| -%> include <%= file %>; <% end -%><% end -%> <%# make sure that allow comes before deny by forcing the allow key (if it -%> <%# exists) to be first in the output order. The hash keys also need to be -%> <%# sorted so that the ordering is stable. -%> -<% if @vhost_cfg_append -%><% vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each_line do |key,value| -%> +<% if @vhost_cfg_append -%><% vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <%= key %> <%= value %>; <% end -%> <% end -%> diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index fc64df0..6621737 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -14,9 +14,9 @@ server { <%# make sure that allow comes before deny by forcing the allow key (if it -%> <%# exists) to be first in the output order. The hash keys also need to be -%> <%# sorted so that the ordering is stable. -%> -<% if @vhost_cfg_prepend -%><% vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each_line do |key,value| -%> +<% if @vhost_cfg_prepend -%><% vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <%= key %> <%= value %>; -<% end -%> +<% end -%><% end -%> <% @proxy_set_header.each do |header| -%> proxy_set_header <%= header %>; <% end -%> diff --git a/templates/vhost/vhost_location_directory.erb b/templates/vhost/vhost_location_directory.erb index 73af430..61705d3 100644 --- a/templates/vhost/vhost_location_directory.erb +++ b/templates/vhost/vhost_location_directory.erb @@ -6,10 +6,10 @@ root <%= @www_root %>; <% end -%> <% if @try_files -%> - try_files <% @try_files.each_line do |try| -%> <%= try %> <% end -%>; + try_files <% @try_files.each do |try| -%> <%= try %> <% end -%>; <% end -%> <% if @index_files -%> - index <% @index_files.each_line do |i| %> <%= i %><% end %>; + index <% @index_files.each do |i| %> <%= i %><% end %>; <% end -%> <% if defined? auth_basic -%> auth_basic "<%= @auth_basic %>"; diff --git a/templates/vhost/vhost_location_fastcgi.erb b/templates/vhost/vhost_location_fastcgi.erb index 73c6c45..1306729 100644 --- a/templates/vhost/vhost_location_fastcgi.erb +++ b/templates/vhost/vhost_location_fastcgi.erb @@ -9,7 +9,7 @@ fastcgi_split_path_info <%= @fastcgi_split_path %>; <% end -%> <% if @try_files -%> - try_files <% @try_files.each_line do |try| -%> <%= try %> <% end -%>; + try_files <% @try_files.each do |try| -%> <%= try %> <% end -%>; <% end -%> include <%= @fastcgi_params %>; fastcgi_pass <%= @fastcgi %>;