Commit 9b16a379 authored by Falko Timme's avatar Falko Timme

- nginx: merge function: default action is now to replace older locations in...

- nginx: merge function: default action is now to replace older locations in the nginx vhost configuration; a merge  instead of a replacement can be achieved by putting the string "##merge##" (without quotes) at the end of the most recent location line (e.g. "location ~ \.php$ { ##merge##").
parent 2655f931
......@@ -118,7 +118,7 @@ server {
</tmpl_loop>
<tmpl_loop name="basic_auth_locations">
location <tmpl_var name='htpasswd_location'> {
location <tmpl_var name='htpasswd_location'> { ##merge##
auth_basic "Members Only";
auth_basic_user_file <tmpl_var name='htpasswd_path'>.htpasswd;
}
......
......@@ -1629,10 +1629,16 @@ class nginx_plugin {
}
unset($loc_parts);
if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace';
if(substr($l, -9) == '##merge##'){
$locations[$location]['action'] = 'merge';
}
if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = ' location '.$location.' {';
if(!isset($locations[$location]['location'])) $locations[$location]['location'] = '';
if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = '';
if(!isset($locations[$location]['end_tag'])) $locations[$location]['end_tag'] = ' }';
if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i;
unset($lines[$i]);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment