Skip to content

Commit

Permalink
Merge pull request voxpupuli#16 from cwarden/per-location-proxy-read-…
Browse files Browse the repository at this point in the history
…timeout

Add per-location proxy read timeout parameter
  • Loading branch information
jamtur01 committed Jan 30, 2012
2 parents 39c569e + 79d0a6a commit 80695c3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 35 deletions.
34 changes: 18 additions & 16 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
# 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
# [*ssl*] - Indicates whether to setup SSL bindings for this location.
# [*option*] - Reserved for future use
# [*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
#
# Actions:
#
Expand All @@ -25,13 +26,14 @@
# vhost => 'test2.local',
# }
define nginx::resource::location(
$ensure = present,
$vhost = undef,
$www_root = undef,
$index_files = ['index.html', 'index.htm', 'index.php'],
$proxy = undef,
$ssl = false,
$option = undef,
$ensure = present,
$vhost = undef,
$www_root = undef,
$index_files = ['index.html', 'index.htm', 'index.php'],
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$ssl = false,
$option = undef,
$location
) {
File {
Expand Down
41 changes: 22 additions & 19 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# [*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
# [*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.
Expand All @@ -31,18 +32,19 @@
# ssl_key => '/tmp/server.pem',
# }
define nginx::resource::vhost(
$ensure = 'enable',
$listen_ip = '*',
$listen_port = '80',
$ipv6_enable = false,
$ipv6_listen_ip = '::',
$ipv6_listen_port = '80',
$ssl = false,
$ssl_cert = undef,
$ssl_key = undef,
$proxy = undef,
$index_files = ['index.html', 'index.htm', 'index.php'],
$www_root = undef
$ensure = 'enable',
$listen_ip = '*',
$listen_port = '80',
$ipv6_enable = false,
$ipv6_listen_ip = '::',
$ipv6_listen_port = '80',
$ssl = false,
$ssl_cert = undef,
$ssl_key = undef,
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$index_files = ['index.html', 'index.htm', 'index.php'],
$www_root = undef
) {

File {
Expand Down Expand Up @@ -77,13 +79,14 @@

# Create the default location reference for the vHost
nginx::resource::location {"${name}-default":
ensure => $ensure,
vhost => $name,
ssl => $ssl,
location => '/',
proxy => $proxy,
www_root => $www_root,
notify => Class['nginx::service'],
ensure => $ensure,
vhost => $name,
ssl => $ssl,
location => '/',
proxy => $proxy,
proxy_read_timeout => $proxy_read_timeout,
www_root => $www_root,
notify => Class['nginx::service'],
}

# Create a proper file close stub.
Expand Down
1 change: 1 addition & 0 deletions templates/vhost/vhost_location_proxy.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
location <%= location %> {
proxy_pass <%= proxy %>;
proxy_read_timeout <%= proxy_read_timeout %>;
}

0 comments on commit 80695c3

Please sign in to comment.