From af05b5ff9f4eb90614118c96503e6fd3ae1bcfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 31 Mar 2019 18:43:02 +0200 Subject: [PATCH] change nginx setup and reload method --- scripts/change_url | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index dfd7eb7..2f615ac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -51,6 +51,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF FILE #================================================= +ynh_print_info "Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -59,18 +60,17 @@ 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" - - ynh_replace_string "location $old_path" "location $new_path" "$nginx_conf_path" - - # Calculate and store the nginx config file checksum - ynh_store_file_checksum "$nginx_conf_path" + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + ynh_add_nginx_config fi # Change the domain for nginx if [ $change_domain -eq 1 ] then ynh_delete_file_checksum "$nginx_conf_path" - sudo mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" fi @@ -80,5 +80,11 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." +sudo systemctl reload nginx -sudo systemctl reload nginx \ No newline at end of file +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Change of URL completed for $app"