diff --git a/scripts/change_url b/scripts/change_url index f86e99b..0d4f239 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -57,6 +57,8 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the nginx config file if [ $change_path -eq 1 ] then + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different "$nginx_conf_path" # Set global variables for nginx helper domain="$old_domain" path_url="$new_path" diff --git a/scripts/install b/scripts/install index e82b024..f221470 100755 --- a/scripts/install +++ b/scripts/install @@ -135,6 +135,11 @@ ynh_setup_source "$final_path" # Create a dedicated nginx config ynh_add_nginx_config +if [ "$path_url" != "/" ] +then + ynh_replace_string "^#sub_path_only" "" "/etc/nginx/conf.d/$domain.d/$app.conf" +fi +ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # CREATE DEDICATED USER @@ -183,7 +188,7 @@ ynh_add_fpm_config ### - And the section "SETUP SYSTEMD" in the upgrade script # Create a dedicated systemd config -ynh_systemd_config +ynh_add_systemd_config #================================================= # SETUP APPLICATION WITH CURL diff --git a/scripts/remove b/scripts/remove index 9a0cf88..2498695 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,6 +17,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) +db_user=$db_name final_path=$(ynh_app_setting_get $app final_path) #================================================= @@ -51,7 +52,7 @@ ynh_remove_app_dependencies #================================================= # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db $db_name $db_name +ynh_mysql_remove_db $db_user $db_name #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/upgrade b/scripts/upgrade index 5063082..2cfb75d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,6 +83,11 @@ ynh_setup_source "$final_path" # Create a dedicated nginx config ynh_add_nginx_config +if [ "$path_url" != "/" ] +then + ynh_replace_string "^#sub_path_only" "" "/etc/nginx/conf.d/$domain.d/$app.conf" +fi +ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # UPGRADE DEPENDENCIES