From 0d38efd7e2fbfa15062b14d1cb5d72afb876fb0d Mon Sep 17 00:00:00 2001 From: Thomas LEBEAU Date: Fri, 13 Jun 2014 09:47:35 +0200 Subject: [PATCH] nginx conf --- conf/nginx.conf | 5 ++--- scripts/install | 12 +++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 697e90f..a896047 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,8 +1,7 @@ location PATHTOCHANGE { alias ALIASTOCHANGE; - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + rewrite ^ ^/admin permanent; + index index.php; try_files $uri $uri/ /index.php?$args; location ~ [^/]\.php(/|$) { diff --git a/scripts/install b/scripts/install index 707ef20..c6f8efe 100644 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,13 @@ if [[ ! $? -eq 0 ]]; then exit 1 fi +# Check that admin user is an existing account +sudo yunohost user list --json | grep -q "\"username\": \"$admin_user\"" +if [[ ! $? -eq 0 ]]; then + echo "Error : the chosen admin user does not exist" + exit 1 +fi + # 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') @@ -42,7 +49,10 @@ 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* -sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/yourls.conf +nginxconf=/etc/nginx/conf.d/$domain.d/yourls.conf +sudo cp ../conf/nginx.conf $nginxconf +sudo chown root: $nginxconf +sudo chmod 600 $nginxconf # Reload Nginx and regenerate SSOwat conf sudo service nginx reload