diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 389e67e..b15f9e7 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -237,7 +237,7 @@ define nginx::resource::vhost ( fastcgi_script => $fastcgi_script, try_files => $try_files, www_root => $www_root, - index_files => undef, + index_files => [], location_custom_cfg => $location_custom_cfg, notify => Class['nginx::service'], } diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 7cfc883..274a659 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -34,7 +34,7 @@ server { return 301 https://$host$request_uri; } <% end -%> -<% if @index_files -%> +<% if @index_files.count > 0 -%> index <% Array(index_files).each do |i| %> <%= i %><% end %>; <% end -%> diff --git a/templates/vhost/vhost_location_directory.erb b/templates/vhost/vhost_location_directory.erb index 785e16d..9b8a6b5 100644 --- a/templates/vhost/vhost_location_directory.erb +++ b/templates/vhost/vhost_location_directory.erb @@ -17,7 +17,7 @@ <% if @autoindex == 'on' -%> autoindex on; <% end -%> -<% if @index_files -%> +<% if @index_files.count > 0 -%> index <% Array(index_files).each do |i| %> <%= i %><% end %>; <% end -%> <% if defined? @auth_basic -%> diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index 0007517..a7ba504 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -20,7 +20,7 @@ server { <% if defined? @auth_basic_user_file -%> auth_basic_user_file "<%= @auth_basic_user_file %>"; <% end -%> -<% if @index_files -%> +<% if @index_files.count > 0 -%> index <% Array(index_files).each do |i| %> <%= i %><% end %>; <% end -%>