diff --git a/conf/nginx.conf b/conf/nginx.conf index 79c5fb2..99ce424 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location PATHTOCHANGE/ { +location PATHTOCHANGE { alias ALIASTOCHANGE ; if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; @@ -14,7 +14,7 @@ location PATHTOCHANGE/ { fastcgi_param PATH_INFO $fastcgi_path_info; } } -location PATHTOCHANGE/http-bind { +location PATHTOCHANGE2/http-bind { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } diff --git a/scripts/install b/scripts/install index 157ecb2..6eee341 100644 --- a/scripts/install +++ b/scripts/install @@ -11,9 +11,10 @@ exit 1 fi # Remove trailing "/" for next commands -if [ ! $path -lt 2 ]; then path=${path%/} -fi + + + # Generate random DES key & password deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') @@ -30,6 +31,12 @@ db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' sudo chown -R www-data: $final_path # Modify Nginx configuration file and copy it to Nginx conf directory +sudo sed -i "s@PATHTOCHANGE2@$path@g" ../conf/nginx.conf + +if [ -z "$path" ]; then + path="/" +fi + sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jappix.conf