Merge pull request #43 from zoide/ssl-fixes

Ssl fixes
This commit is contained in:
James Fryman 2013-04-13 10:04:25 -07:00
commit 108c5b8f15
4 changed files with 76 additions and 74 deletions

View file

@ -51,7 +51,10 @@ define nginx::resource::location(
$ensure = present,
$vhost = undef,
$www_root = undef,
$index_files = ['index.html', 'index.htm', 'index.php'],
$index_files = [
'index.html',
'index.htm',
'index.php'],
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$ssl = false,
@ -62,8 +65,7 @@ define nginx::resource::location(
$location_cfg_prepend = undef,
$location_cfg_append = undef,
$try_files = undef,
$location
) {
$location) {
File {
owner => 'root',
group => 'root',
@ -92,15 +94,17 @@ define nginx::resource::location(
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)) {
fail('Cannot define both directory and proxy in a virtual host')
}
# # Create stubs for vHost File Fragment Pattern
if ($ssl_only != 'true') {
if (!$ssl_only) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${vhost}-500-${name}":
ensure => $ensure_real,
content => $content_real,
@ -108,7 +112,7 @@ define nginx::resource::location(
}
# # Only create SSL Specific locations if $ssl is true.
if ($ssl == 'true') {
if ($ssl) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${vhost}-800-${name}-ssl":
ensure => $ensure_real,
content => $content_real,

View file

@ -58,8 +58,7 @@ define nginx::resource::mailhost(
$protocol = undef,
$auth_http = undef,
$xclient = 'on',
$server_name = [$name]
) {
$server_name = [$name]) {
File {
owner => 'root',
group => 'root',

View file

@ -19,10 +19,7 @@
# 'localhost:3002',
# ],
# }
define nginx::resource::upstream (
$ensure = 'present',
$members
) {
define nginx::resource::upstream ($ensure = 'present', $members) {
File {
owner => 'root',
group => 'root',

View file

@ -54,15 +54,16 @@ define nginx::resource::vhost(
$ssl_port = '443',
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$index_files = ['index.html', 'index.htm', 'index.php'],
$index_files = [
'index.html',
'index.htm',
'index.php'],
$server_name = [$name],
$www_root = undef,
$rewrite_www_to_non_www = false,
$location_cfg_prepend = undef,
$location_cfg_append = undef,
$try_files = undef
) {
$try_files = undef) {
File {
owner => 'root',
group => 'root',
@ -116,14 +117,14 @@ define nginx::resource::vhost(
# Support location_cfg_prepend and location_cfg_append on default location created by vhost
if $location_cfg_prepend {
Nginx::Resource::Location["${name}-default"] {
location_cfg_prepend => $location_cfg_prepend
}
location_cfg_prepend => $location_cfg_prepend }
}
if $location_cfg_append {
Nginx::Resource::Location["${name}-default"] {
location_cfg_append => $location_cfg_append
}
location_cfg_append => $location_cfg_append }
}
# Create a proper file close stub.
if ($listen_port != $ssl_port) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699":
@ -137,7 +138,7 @@ define nginx::resource::vhost(
}
# Create SSL File Stubs if SSL is enabled
if ($ssl == 'true') {
if ($ssl) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl":
ensure => $ensure ? {
'absent' => absent,
@ -146,6 +147,7 @@ define nginx::resource::vhost(
content => template('nginx/vhost/vhost_ssl_header.erb'),
notify => Class['nginx::service'],
}
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-999-ssl":
ensure => $ensure ? {
'absent' => absent,