diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 389e67ecd..b15f9e766 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -237,7 +237,7 @@ 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 7cfc883e5..274a6599e 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 785e16d11..9b8a6b511 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 0007517ed..a7ba50442 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 -%>