diff --git a/conf/nginx.conf b/conf/nginx.conf index 419b950..c61e9ce 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location PATHTOCHANGE { +location PATHTOCHANGE/ { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } diff --git a/scripts/install b/scripts/install index 6f42082..475cbac 100644 --- a/scripts/install +++ b/scripts/install @@ -16,6 +16,7 @@ if [[ ! $? -eq 0 ]]; then fi # Configure Nginx and reload -sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf +# Removing trailing '/' in path to handle both subdir and subdomain installs. +sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/rspamdui.conf sudo service nginx reload diff --git a/scripts/remove b/scripts/remove index 7ae1e19..9dcb1d2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,7 @@ #!/bin/bash -domain=$(sudo yunohost app setting transmission domain) +domain=$(sudo yunohost app setting rspamdui domain) -sudo rm /etc/nginx/conf.d/$domain.d/transmission.conf +sudo rm /etc/nginx/conf.d/$domain.d/rspamdui.conf sudo service nginx reload sudo yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade index 94b1642..e344874 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,8 +1,8 @@ #!/bin/bash # Retrieve arguments -domain=$(sudo yunohost app setting transmission domain) -path=$(sudo yunohost app setting transmission path) +domain=$(sudo yunohost app setting rspamdui domain) +path=$(sudo yunohost app setting rspamdui path) # Check port availability sudo yunohost app checkport 11334 @@ -11,6 +11,6 @@ if [[ ! $? -eq 0 ]]; then fi # Configure Nginx and reload -sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf +sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/rspamdui.conf sudo service nginx reload