From 7ca0ff019fe5e81be16309a331cd4f047e168826 Mon Sep 17 00:00:00 2001 From: aymhce Date: Thu, 11 Jan 2018 22:10:06 +0100 Subject: [PATCH] fix from YunoHost/example_ynh#45 for #21 --- conf/nginx.conf | 3 ++- scripts/install | 4 ++++ scripts/upgrade | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 043db70..8946b17 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location __PATH__ { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { alias __FINALPATH__/; diff --git a/scripts/install b/scripts/install index cf95a50..dfaae5f 100644 --- a/scripts/install +++ b/scripts/install @@ -70,6 +70,10 @@ ynh_replace_string "RANDOMKEYTOCHANGE" $(ynh_string_random 24) $final_path/confi # NGINX CONFIGURATION #================================================= +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 4c064b3..3101a6b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,6 +45,10 @@ ampache_ynh_prepareconfig #================================================= # Modify Nginx configuration file and copy it to Nginx conf directory +if [ "$path_url" != "/" ] +then + ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf" +fi ynh_add_nginx_config #=================================================