diff --git a/conf/nginx.conf b/conf/nginx.conf index 521a8f2..d3ae0b8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location __PATH__ { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { proxy_pass http://127.0.0.1:__PORT__; proxy_set_header Host $host; proxy_redirect off; diff --git a/scripts/install b/scripts/install index 2043f3b..204de79 100644 --- a/scripts/install +++ b/scripts/install @@ -76,6 +76,12 @@ mkdir "$final_path/data" # 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5c93105..bc1f861 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,6 +84,11 @@ mkdir -p "$final_path/data" # 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