Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed errors and implemented new functions #59

Merged
merged 23 commits into from
May 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dede78a
(#11664) Fix listen_port in template so it isn't ignored
grooverdan Jan 3, 2012
719028c
(#11667) add try_files support in vhost and location directives
Jan 22, 2012
a214b0f
Support vhosts that listen on alternative ports
cwarden Jan 11, 2012
ddf0264
Added support for yet another redhat clone - scientific linux
tobixen Oct 13, 2012
6f40d27
Merge pull request #27 from tobixen/master
Oct 16, 2012
20d3e2f
Merge pull request #10 from grooverdan/ticket/11664-listen_port_fix
nicklewis Oct 19, 2012
7f3f238
Merge remote-tracking branch 'cwarden/alternative-ports'
nicklewis Oct 19, 2012
4aa2dd3
Merge remote-tracking branch 'grooverdan/ticket/11667-try_files_support'
nicklewis Oct 19, 2012
003f415
Merge remote-tracking branch 'jfryman/master' into merge_upstream
hunner Nov 8, 2012
b65114d
Fixup incorrect changes from merge
hunner Nov 8, 2012
39f848c
Rebase bashtoni's pull request from a year ago:
joejulian Dec 6, 2012
1441edc
Merge pull request #30 from hunner/merge_upstream
hunner Dec 10, 2012
74cfbe6
Add $nx_types_hash_max_size params
abraham1901 Mar 16, 2013
a7c9057
Merge branch 'master' of https://github.com/jfryman/puppet-nginx
abraham1901 Mar 20, 2013
23c5bf7
Merge branch 'master' of https://github.com/joejulian/puppetlabs-nginx
abraham1901 Mar 20, 2013
9e56456
Add fastcgi template
abraham1901 Mar 27, 2013
6defe17
Add proxy_cache parameters
abraham1901 Mar 27, 2013
bcb5647
Add new line to template
abraham1901 Mar 28, 2013
9672b7d
* Get ssl key/cert with provided file-locations
abraham1901 Apr 16, 2013
4f0c311
* Fixed listen parameter in template vhost_ssl_header
abraham1901 May 20, 2013
8d33fd6
Merge branch 'master' of https://github.com/jfryman/puppet-nginx
abraham1901 May 21, 2013
d7cdd68
Merge branch 'master' of https://github.com/jfryman/puppet-nginx
abraham1901 May 21, 2013
a5ebd57
Merge branch 'master' of https://github.com/jfryman/puppet-nginx
abraham1901 May 21, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2011-12-23 Sam Bashton <[email protected]>
* manifests/resource/location.pp,manifests/resource/vhost.pp,
templates/vhost/vhost_location_fastcgi.erb: Add support for fastcgi

2011-06-06 James Fryman <[email protected]>

* Modulefile, README, files/README.markdown, lib/facter/README.markdown,
Expand Down
28 changes: 16 additions & 12 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
#
# This class file is not called directly
class nginx::config(
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$confd_purge = $nginx::params::nx_confd_purge,
$server_tokens = $nginx::params::nx_server_tokens,
$types_hash_max_size = $nginx::params::nx_types_hash_max_size,
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$confd_purge = $nginx::params::nx_confd_purge,
$server_tokens = $nginx::params::nx_server_tokens,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_cache_levels = $nginx::params::nx_proxy_cache_levels,
$proxy_cache_keys_zone = $nginx::params::nx_proxy_cache_keys_zone,
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
$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
) inherits nginx::params {
File {
Expand All @@ -29,7 +34,7 @@
mode => '0644',
}

file { "${nginx::params::nx_conf_dir}":
file { $nginx::params::nx_conf_dir:
ensure => directory,
}

Expand All @@ -55,17 +60,16 @@
}
}


file { "${nginx::config::nx_run_dir}":
file {$nginx::config::nx_run_dir:
ensure => directory,
}

file { "${nginx::config::nx_client_body_temp_path}":
file {$nginx::config::nx_client_body_temp_path:
ensure => directory,
owner => $nginx::params::nx_daemon_user,
}

file {"${nginx::config::nx_proxy_temp_path}":
file {$nginx::config::nx_proxy_temp_path:
ensure => directory,
owner => $nginx::params::nx_daemon_user,
}
Expand Down
47 changes: 28 additions & 19 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# Parameters:
#
# There are no default parameters for this class. All module parameters are
# managed via the nginx::params class
# There are no default parameters for this class. All module parameters are managed
# via the nginx::params class
#
# Actions:
#
Expand All @@ -29,15 +29,20 @@
# include nginx
# }
class nginx (
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$confd_purge = $nginx::params::nx_confd_purge,
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restart,
$mail = $nginx::params::nx_mail,
$server_tokens = $nginx::params::nx_server_tokens
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$confd_purge = $nginx::params::nx_confd_purge,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_cache_levels = $nginx::params::nx_proxy_cache_levels,
$proxy_cache_keys_zone = $nginx::params::nx_proxy_cache_keys_zone,
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restrart,
$mail = $nginx::params::nx_mail,
$server_tokens = $nginx::params::nx_server_tokens
) inherits nginx::params {

include stdlib
Expand All @@ -47,14 +52,18 @@
}

class { 'nginx::config':
worker_processes => $worker_processes,
worker_connections => $worker_connections,
proxy_set_header => $proxy_set_header,
proxy_http_version => $proxy_http_version,
confd_purge => $confd_purge,
server_tokens => $server_tokens,
require => Class['nginx::package'],
notify => Class['nginx::service'],
worker_processes => $worker_processes,
worker_connections => $worker_connections,
proxy_set_header => $proxy_set_header,
proxy_http_version => $proxy_http_version,
proxy_cache_path => $proxy_cache_path,
proxy_cache_levels => $proxy_cache_levels,
proxy_cache_keys_zone => $proxy_cache_keys_zone,
proxy_cache_max_size => $proxy_cache_max_size,
proxy_cache_inactive => $proxy_cache_inactive,
confd_purge => $confd_purge,
require => Class['nginx::package'],
notify => Class['nginx::service'],
}

class { 'nginx::service':
Expand Down
38 changes: 22 additions & 16 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,37 @@
#
# This class file is not called directly
class nginx::params {
$nx_temp_dir = '/tmp'
$nx_run_dir = '/var/nginx'
$nx_temp_dir = '/tmp'
$nx_run_dir = '/var/nginx'

$nx_conf_dir = '/etc/nginx'
$nx_confd_purge = false
$nx_worker_processes = 1
$nx_worker_connections = 1024
$nx_types_hash_max_size = 1024
$nx_types_hash_bucket_size = 512
$nx_multi_accept = off
$nx_conf_dir = '/etc/nginx'
$nx_confd_purge = false
$nx_worker_processes = 1
$nx_worker_connections = 1024
$nx_types_hash_max_size = 1024
$nx_types_hash_bucket_size = 512
$nx_multi_accept = off
$nx_events_use = false # One of [kqueue|rtsig|epoll|/dev/poll|select|poll|eventport] or false to use OS default
$nx_sendfile = on
$nx_keepalive_timeout = 65
$nx_tcp_nodelay = on
$nx_gzip = on
$nx_server_tokens = on
$nx_spdy = off
$nx_ssl_stapling = off
$nx_sendfile = on
$nx_keepalive_timeout = 65
$nx_tcp_nodelay = on
$nx_gzip = on
$nx_server_tokens = on
$nx_spdy = off
$nx_ssl_stapling = off


$nx_proxy_redirect = off
$nx_proxy_set_header = [
'Host $host',
'X-Real-IP $remote_addr',
'X-Forwarded-For $proxy_add_x_forwarded_for',
]
$nx_proxy_cache_path = false
$nx_proxy_cache_levels = 1
$nx_proxy_cache_keys_zone = 'd2:100m'
$nx_proxy_cache_max_size = '500m'
$nx_proxy_cache_inactive = '20m'

$nx_client_body_temp_path = "${nx_run_dir}/client_body_temp"
$nx_client_body_buffer_size = '128k'
Expand Down
52 changes: 40 additions & 12 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# [*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
# [*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
Expand All @@ -19,6 +22,14 @@
# [*location_cfg_append*] - It expects a hash with custom directives to put after everything else inside location
# [*try_files*] - An array of file locations to try
# [*option*] - Reserved for future use
# [*proxy_cache*] - This directive sets name of zone for caching.
# The same zone can be used in multiple places.
# [*proxy_cache_valid*] - This directive sets the time for caching
# different replies.
# [*auth_basic*] - This directive includes testing name and password
# with HTTP Basic Authentication.
# [*auth_basic_user_file*] - This directive sets the htpasswd filename for
# the authentication realm.
#
# Actions:
#
Expand Down Expand Up @@ -58,14 +69,21 @@
'index.php'],
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$fastcgi = undef,
$fastcgi_params = '/etc/nginx/fastcgi_params',
$fastcgi_script = undef,
$ssl = false,
$ssl_only = false,
$location_alias = undef,
$option = undef,
$stub_status = undef,
$location_cfg_prepend = undef,
$location_cfg_append = undef,
$try_files = undef
$try_files = undef,
$proxy_cache = false,
$proxy_cache_valid = false,
$auth_basic = undef,
$auth_basic_user_file = undef
) {
File {
owner => 'root',
Expand All @@ -80,43 +98,53 @@
default => file,
}

# Use proxy template if $proxy is defined, otherwise use directory template.
# Use proxy or fastcgi template if $proxy is defined, otherwise use directory template.
if ($proxy != undef) {
$content_real = template('nginx/vhost/vhost_location_proxy.erb')
} elsif ($location_alias != undef) {
$content_real = template('nginx/vhost/vhost_location_alias.erb')
} elsif ($stub_status != undef) {
$content_real = template('nginx/vhost/vhost_location_stub_status.erb')
} elsif ($fastcgi != undef) {
$content_real = template('nginx/vhost/vhost_location_fastcgi.erb')
} else {
$content_real = template('nginx/vhost/vhost_location_directory.erb')
}

# # Check for various error condtiions
## Check for various error conditions
if ($vhost == undef) {
fail('Cannot create a location reference without attaching to a virtual host')
}

if (($www_root == undef) and ($proxy == undef) and ($location_alias == undef) and ($stub_status == undef)) {
fail('Cannot create a location reference without a www_root, proxy, location_alias or stub_status defined')
if (($www_root == undef) and ($proxy == undef) and ($location_alias == undef) and ($stub_status == undef) and ($fastcgi == undef)) {
fail('Cannot create a location reference without a www_root, proxy, location_alias, fastcgi or stub_status defined')
}

if (($www_root != undef) and ($proxy != undef)) {
fail('Cannot define both directory and proxy in a virtual host')
}

# # Create stubs for vHost File Fragment Pattern
if (!$ssl_only) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${vhost}-500-${name}":
## Create stubs for vHost File Fragment Pattern
if ($ssl_only != 'true') {
file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-500-${name}":
ensure => $ensure_real,
content => $content_real,
}
}

# # Only create SSL Specific locations if $ssl is true.
if ($ssl) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${vhost}-800-${name}-ssl":
## Only create SSL Specific locations if $ssl is true.
if ($ssl == 'true') {
file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-800-${name}-ssl":
ensure => $ensure_real,
content => $content_real,
}
}

if ($auth_basic_user_file != undef) {
#Generate htpasswd with provided file-locations
file { "${nginx::params::nx_conf_dir}/${name}_htpasswd":
ensure => $ensure,
mode => '0644',
source => $auth_basic_user_file,
}
}
}
Loading