From 9f4b3eca57977cf6ede23094c62c88a0d2059032 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 27 Feb 2019 03:17:55 +0100 Subject: [PATCH] Fix sub_path --- conf/nginx.conf | 2 +- scripts/install | 6 ++++++ scripts/upgrade | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f5b58b8..a299dba 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,7 +3,7 @@ location ^~ __PATH__/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $proxy_connection; - proxy_set_header X-Forwarded-Host $server_name__PATH__; + proxy_set_header X-Forwarded-Host $server_name__SUB_PATH__; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; diff --git a/scripts/install b/scripts/install index 13f5be6..b8d2765 100644 --- a/scripts/install +++ b/scripts/install @@ -163,6 +163,12 @@ ynh_app_setting_set $app final_path $final_path ynh_print_info "Configuring nginx web server..." ### `ynh_add_nginx_config` will use the file conf/nginx.conf +if [ $path = "/" ] +then + ynh_replace_string "__SUB_PATH__" "" "..conf/nginx.conf" +else + ynh_replace_string "__SUB_PATH__" "$path" "..conf/nginx.conf" +fi # Create a dedicated nginx config ynh_add_nginx_config "nextclouddomain" diff --git a/scripts/upgrade b/scripts/upgrade index 23c9ee9..cfe71cf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,6 +77,12 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config +if [ $path = "/" ] +then + ynh_replace_string "__SUB_PATH__" "" "..conf/nginx.conf" +else + ynh_replace_string "__SUB_PATH__" "$path" "..conf/nginx.conf" +fi ynh_add_nginx_config "nextclouddomain" #=================================================