diff --git a/conf/nginx.conf b/conf/nginx.conf index 6e8d3c9..d2bfccb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,6 @@ -location PATHTOCHANGE { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - rewrite PATHTOCHANGE/(.*) /$1 break; +location PATHTOCHANGE/ { rewrite ^PATHTOCHANGE$ PATHTOCHANGE/ permanent; proxy_pass http://localhost:9001/; - proxy_redirect / PATHTOCHANGE/; proxy_set_header Host $host; proxy_buffering off; } diff --git a/conf/nginx.conf-nosub b/conf/nginx.conf-nosub index 9a0fd70..954771d 100644 --- a/conf/nginx.conf-nosub +++ b/conf/nginx.conf-nosub @@ -1,9 +1,6 @@ location / { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } proxy_pass http://localhost:9001/; proxy_set_header Host $host; - # be carefull, this line doesn't override any proxy_buffering on set in a conf.d/file.conf + # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf proxy_buffering off; } diff --git a/scripts/install b/scripts/install index 59bc2b2..a4e256d 100644 --- a/scripts/install +++ b/scripts/install @@ -11,6 +11,9 @@ if [[ ! $? -eq 0 ]]; then exit 1 fi +# Remove trailing "/" for next commands +path=${path%/} + # Generate random password db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') @@ -55,16 +58,16 @@ sudo chown -R www-data: $final_path # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf* sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf* -if [ $path != "/" ]; +if [ "$path" = "" ]; then - sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/etherpadlite.conf -else sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/etherpadlite.conf +else + sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/etherpadlite.conf fi # Reload Nginx and regenerate SSOwat conf sudo service nginx reload -if [ $is_public = "Yes" ]; +if [ "$is_public" = "Yes" ]; then sudo yunohost app setting etherpadlite skipped_uris -v "/" fi