possibility to disable default location
This commit is contained in:
parent
2cc0a2fcf0
commit
82ce9223a9
3 changed files with 33 additions and 22 deletions
|
@ -135,6 +135,7 @@ define nginx::resource::vhost (
|
|||
$access_log = undef,
|
||||
$error_log = undef,
|
||||
$passenger_cgi_param = undef,
|
||||
$use_default_location = true,
|
||||
) {
|
||||
|
||||
validate_array($location_allow)
|
||||
|
@ -194,6 +195,7 @@ define nginx::resource::vhost (
|
|||
$ssl_only = true
|
||||
}
|
||||
|
||||
if $use_default_location == true {
|
||||
# Create the default location reference for the vHost
|
||||
nginx::resource::location {"${name}-default":
|
||||
ensure => $ensure,
|
||||
|
@ -216,6 +218,9 @@ define nginx::resource::vhost (
|
|||
location_custom_cfg => $location_custom_cfg,
|
||||
notify => Class['nginx::service'],
|
||||
}
|
||||
} else {
|
||||
$root = $www_root
|
||||
}
|
||||
|
||||
# Support location_cfg_prepend and location_cfg_append on default location created by vhost
|
||||
if $location_cfg_prepend {
|
||||
|
|
|
@ -17,6 +17,9 @@ server {
|
|||
<% if @vhost_cfg_prepend -%><% vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
|
||||
<%= key %> <%= value %>;
|
||||
<% end -%><% end -%>
|
||||
<% if @root -%>
|
||||
root <%= @root %>;
|
||||
<% end -%>
|
||||
<% if @passenger_cgi_param -%><% @passenger_cgi_param.each do |key,value| -%>
|
||||
passenger_set_cgi_param <%= key %> <%= value %>;
|
||||
<% end -%><% end -%>
|
||||
|
|
|
@ -24,6 +24,9 @@ server {
|
|||
access_log <%= @ssl_access_log %>;
|
||||
error_log <%= @ssl_error_log %>;
|
||||
|
||||
<% if @root -%>
|
||||
root <%= @root %>;
|
||||
<% end -%>
|
||||
<% if @passenger_cgi_param -%><% @passenger_cgi_param.each do |key,value| -%>
|
||||
passenger_set_cgi_param <%= key %> <%= value %>;
|
||||
<% end -%><% end -%>
|
||||
|
|
Loading…
Reference in a new issue