Merge remote-tracking branch 'cwarden/alternative-ports'

This commit is contained in:
Nick Lewis 2012-10-18 18:58:59 -07:00
commit 7f3f238f96
4 changed files with 26 additions and 16 deletions

View file

@ -3,6 +3,7 @@
# This definition creates a virtual host
#
# Parameters:
# [*server_name*] - Server name (value to match in Host: header). Defaults to the resource's name.
# [*ensure*] - Enables or disables the specified vhost (present|absent)
# [*listen_ip*] - Default IP Address for NGINX to listen with this vHost on. Defaults to all interfaces (*)
# [*listen_port*] - Default IP Port for NGINX to listen with this vHost on. Defaults to TCP 80
@ -32,19 +33,20 @@
# 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,
$server_name = $name,
$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
$index_files = ['index.html', 'index.htm', 'index.php'],
$www_root = undef
) {
File {

View file

@ -1,6 +1,6 @@
server {
listen <%= listen_ip %>:<%= listen_port %>;
listen <%= listen_ip %>:<%= listen_port %>;
<% # 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 %>;
access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= name %>.access.log;

View file

@ -1,7 +1,7 @@
server {
listen 443;
<% if ipv6_enable == 'true' && (defined? ipaddress6) %>listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> default ipv6only=on;<% end %>
server_name <%= name %>;
server_name <%= server_name %>;
ssl on;
ssl_certificate <%= ssl_cert %>;

View file

@ -1,4 +1,4 @@
include nginix
include nginx
nginx::resource::vhost { 'test.local':
ensure => present,
@ -6,3 +6,11 @@ nginx::resource::vhost { 'test.local':
proxy => 'http://proxypass',
}
nginx::resource::vhost { 'test.local:8080':
listen_port => 8080,
server_name => 'test.local',
ensure => present,
ipv6_enable => 'true',
proxy => 'http://proxypass',
}