From e2829da039654f723e420e9fd340c183d134466b Mon Sep 17 00:00:00 2001 From: Duncan Hutty Date: Mon, 10 Sep 2012 17:15:32 -0400 Subject: [PATCH] add an array parameter to resource::vhost, server_name, that goes into the server_name nginx directive for that vhost --- manifests/resource/vhost.pp | 2 ++ templates/vhost/vhost_header.erb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 177485fb5..ac97b1c9b 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -17,6 +17,7 @@ # [*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. +# [*server_name*] - List of vhostnames for which this vhost will respond. Default [$name]. # [*www_root*] - Specifies the location on disk for files to be read from. Cannot be set in conjunction with $proxy # # Actions: @@ -44,6 +45,7 @@ $proxy = undef, $proxy_read_timeout = $nginx::params::nx_proxy_read_timeout, $index_files = ['index.html', 'index.htm', 'index.php'], + $server_name = [$name], $www_root = undef ) { diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 1c6332f96..37212440d 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -2,5 +2,5 @@ server { listen <%= listen_ip %>; <% # check to see if ipv6 support exists in the kernel before applying %> <% if ipv6_enable == 'true' && (defined? ipaddress6) %>listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> default ipv6only=on;<% end %> - server_name <%= name %>; + server_name <%= server_name.join(" ") %>; access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= name %>.access.log;