diff --git a/conf/nginx.conf b/conf/nginx.conf index 9867550..13d7d68 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -35,7 +35,7 @@ location @__NAME__ { rewrite ^ __PATH__/app.php/$is_args$args; } -#noroot location __PATH__ { -#noroot return 301 __PATH__/; -#noroot } +#for-subdir location __PATH__ { +#for-subdir return 301 __PATH__/; +#for-subdir } diff --git a/scripts/install b/scripts/install index d738015..599cfd6 100644 --- a/scripts/install +++ b/scripts/install @@ -126,13 +126,12 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_user" <<< "UPDATE craue_config_s ynh_add_nginx_config if [ "$path_url" = "/" ] then - # Remove prefix on #noroot lines - sudo sed --in-place '/#noroot*/d' /etc/nginx/conf.d/$domain.d/$app.conf # Replace "//" location (due to nginx template) - ynh_replace_string " // " " / " /etc/nginx/conf.d/$domain.d/$app.conf + # Prevent from replacing in "http://" expressions by excluding ":" as preceding character + sudo sed --in-place "s@\([^:]\)//@\1/@g" /etc/nginx/conf.d/$domain.d/$app.conf else - # Remove #noroot lines - ynh_replace_string "#noroot" "" /etc/nginx/conf.d/$domain.d/$app.conf + # Move prefix comment #for-subdir at end of lines + sudo sed --in-place "s/#for-subdir\(.*\)/\1 #for-subdir/g" /etc/nginx/conf.d/$domain.d/$app.conf fi ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index e6e98d7..8fef0df 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,13 +116,12 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_user" <<< "UPDATE craue_config_s ynh_add_nginx_config if [ "$path_url" = "/" ] then - # Remove prefix on #noroot lines - sudo sed --in-place '/#noroot*/d' /etc/nginx/conf.d/$domain.d/$app.conf # Replace "//" location (due to nginx template) - ynh_replace_string " // " " / " /etc/nginx/conf.d/$domain.d/$app.conf + # Prevent from replacing in "http://" expressions by excluding ":" as preceding character + sudo sed --in-place "s@\([^:]\)//@\1/@g" /etc/nginx/conf.d/$domain.d/$app.conf else - # Remove #noroot lines - ynh_replace_string "#noroot" "" /etc/nginx/conf.d/$domain.d/$app.conf + # Move prefix comment #for-subdir at end of lines + sudo sed --in-place "s/#for-subdir\(.*\)/\1 #for-subdir/g" /etc/nginx/conf.d/$domain.d/$app.conf fi ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"