From 2d21ec616327317278575a35b5ed8f1a4d0b5d77 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 3 Jan 2018 23:24:48 +0100 Subject: [PATCH] Update fix alias_traversal --- conf/nginx.conf | 2 +- scripts/install | 4 ++++ scripts/upgrade | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 79e996e..8c40e3a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -rewrite ^__PATH__$ ^__PATH__/ permanent; +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { # Path to source diff --git a/scripts/install b/scripts/install index 6a4bcfa..ad73d75 100755 --- a/scripts/install +++ b/scripts/install @@ -104,6 +104,10 @@ ynh_setup_source "$final_path" #================================================= # Create a dedicated nginx config +if [ "$path_url" != "/" ] +then + ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf" +fi ynh_add_nginx_config #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 30c17ef..f510647 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -82,6 +82,10 @@ ynh_setup_source "$final_path" #================================================= # Create a dedicated nginx config +if [ "$path_url" != "/" ] +then + ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf" +fi ynh_add_nginx_config #=================================================