Skip to content

Commit 4114199

Browse files
committed
add an array parameter to resource::vhost, server_name, that goes into the server_name nginx directive for that vhost
1 parent b302fcf commit 4114199

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

manifests/resource/vhost.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# [*ssl*] - Indicates whether to setup SSL bindings for this vhost.
1818
# [*ssl_cert*] - Pre-generated SSL Certificate file to reference for SSL Support. This is not generated by this module.
1919
# [*ssl_key*] - Pre-generated SSL Key file to reference for SSL Support. This is not generated by this module.
20+
# [*server_name*] - List of vhostnames for which this vhost will respond. Default [$name].
2021
# [*www_root*] - Specifies the location on disk for files to be read from. Cannot be set in conjunction with $proxy
2122
#
2223
# Actions:
@@ -44,6 +45,7 @@
4445
$proxy = undef,
4546
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
4647
$index_files = ['index.html', 'index.htm', 'index.php'],
48+
$server_name = [$name],
4749
$www_root = undef
4850
) {
4951

templates/vhost/vhost_header.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ server {
22
listen <%= listen_ip %>;
33
<% # check to see if ipv6 support exists in the kernel before applying %>
44
<% if ipv6_enable == 'true' && (defined? ipaddress6) %>listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> default ipv6only=on;<% end %>
5-
server_name <%= name %>;
5+
server_name <%= server_name.join(" ") %>;
66
access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= name %>.access.log;

0 commit comments

Comments
 (0)