Merge remote-tracking branch 'grooverdan/ticket/11667-try_files_support'

This commit is contained in:
Nick Lewis 2012-10-18 19:15:09 -07:00
commit 4aa2dd3d35
3 changed files with 21 additions and 12 deletions

View file

@ -3,16 +3,17 @@
# 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
# [*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
# [*ssl*] - Indicates whether to setup SSL bindings for this location.
# [*option*] - Reserved for future use
# [*ssl*] - Indicates whether to setup SSL bindings for this location.
# [*try_files*] - An array of file locations to try
# [*option*] - Reserved for future use
#
# Actions:
#
@ -33,6 +34,7 @@ define nginx::resource::location(
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$ssl = false,
$try_files = undef,
$option = undef,
$location
) {

View file

@ -19,6 +19,7 @@
# [*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.
# [*www_root*] - Specifies the location on disk for files to be read from. Cannot be set in conjunction with $proxy
# [*try_files*] - Specifies the locations for files to be checked as an array. Cannot be used in conjuction with $proxy.
#
# Actions:
#
@ -46,7 +47,8 @@ define nginx::resource::vhost(
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$index_files = ['index.html', 'index.htm', 'index.php'],
$www_root = undef
$www_root = undef,
$try_files = undef
) {
File {
@ -85,8 +87,9 @@ define nginx::resource::vhost(
vhost => $name,
ssl => $ssl,
location => '/',
proxy => $proxy,
proxy_read_timeout => $proxy_read_timeout,
proxy => $proxy,
try_files => $try_files,
www_root => $www_root,
notify => Class['nginx::service'],
}

View file

@ -1,4 +1,8 @@
location <%= location %> {
root <%= www_root %>;
index <% index_files.each do |i| %> <%= i %> <% end %>;
index <% index_files.each do |i| %> <%= i %> <% end %>;
<% if has_variable?("try_files") then %>
try_files <% try_files.each do |try| -%> <%= try %> <% end -%>;
<% end %>
}