From 230356a0148c44586696e8bfb4eb9f273cf68506 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 18 Feb 2018 10:06:21 +0000 Subject: [PATCH] Fix nginx hacks in upgrade --- scripts/install | 2 +- scripts/upgrade | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 2afb068..e56e205 100644 --- a/scripts/install +++ b/scripts/install @@ -201,7 +201,7 @@ if [[ -n $admin && -n $title ]]; then ynh_mysql_execute_as_root "$sql_command" $db_name # Install the SSOwat auth extension - exec_composer $app $final_path "require tituspijean/flarum-ext-auth-ssowat:*@dev --ansi" + exec_composer $app $final_path "require tituspijean/flarum-ext-auth-ssowat:0.4.x-dev --ansi" # Configure SSOwat auth extension ssowatdomain=$( /dev/null; then +if ! type "$final_path/composer.phar" > /dev/null; then init_composer $app $final_path fi @@ -111,6 +111,7 @@ fi #================================================= # Install Flarum +exec_composer $app $final_path "require tituspijean/flarum-ext-auth-ssowat:0.4.x-dev --ansi" exec_composer $app $final_path "update --ansi" pushd $final_path exec_as $app php flarum cache:clear @@ -120,6 +121,15 @@ popd # NGINX CONFIGURATION #================================================= +# Bug in Nginx with locations and aliases (see http://stackoverflow.com/a/35102259 ) +if [ $path_url = "/" ]; then + sed -i "s@__LOCATION_HACK__@@g" ../conf/nginx.conf + sed -i "s@__PATH_HACK__@/@g" ../conf/nginx.conf +else + sed -i "s@__LOCATION_HACK__@$path_url@g" ../conf/nginx.conf + sed -i "s@__PATH_HACK__@$path_url$path_url@g" ../conf/nginx.conf +fi + # Create a dedicated nginx config ynh_add_nginx_config