From 0346f4ebbb31f1eb657fe4401806dbc095908b13 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 22 Oct 2012 15:05:58 +0530 Subject: [PATCH] Remove http and www from sitename --- setup/engine | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/setup/engine b/setup/engine index a9dc7b07..6a82c761 100755 --- a/setup/engine +++ b/setup/engine @@ -354,40 +354,45 @@ then if [ -n "$3" ] then + # Remove http:// & www. + Domain=$(echo $3 | sed "s'http://''" | sed "s'www.''") + # Creating Site - echo "Creating $3, please wait..." - sed "s/example.com/$3/g" ../conf/nginx/basic.conf \ - > /etc/nginx/sites-available/$3 \ - || OwnError "Unable to create configuration file for $3" + echo "Creating $Domain, please wait..." + sed "s/example.com/$Domain/g" ../conf/nginx/basic.conf \ + > /etc/nginx/sites-available/$Domain \ + || OwnError "Unable to create configuration file for $Domain" # Creating Symbolic Link - ln -s /etc/nginx/sites-available/$3 /etc/nginx/sites-enabled/ \ - || OwnError "Unable to create symbolic link for $3" + ln -s /etc/nginx/sites-available/$Domain /etc/nginx/sites-enabled/ \ + || OwnError "Unable to create symbolic link for $Domain" # Creating Htdocs & Logs Directory - mkdir -p /var/www/$3/{htdocs,logs} \ + mkdir -p /var/www/$Domain/{htdocs,logs} \ || OwnError "Unable to create htdocs and logs directory" # Creating Symbolic Links For Logs - ln -s /var/log/nginx/$3.{accss.log,error.log} /var/www/$3/logs/ \ - || OwnError "Unable to create symbolic link for $3 logs" + ln -s /var/log/nginx/$Domain.{accss.log,error.log} /var/www/$Domain/logs/ \ + || OwnError "Unable to create symbolic link for $Domain logs" if [ "$4" = "--with-wordpress" ] then # Download Latest Wordpress - wget -cO /var/www/$3/htdocs/latest.tar.gz \ + wget -cO /var/www/$Domain/htdocs/latest.tar.gz \ http://wordpress.org/latest.tar.gz # Extracting Wordpress - tar --strip-components=1 -zxf /var/www/$3/htdocs/latest.tar.gz \ - -C /var/www/$3/htdocs/ + tar --strip-components=1 -zxf /var/www/$Domain/htdocs/latest.tar.gz \ + -C /var/www/$Domain/htdocs/ # Removing Wordpress Archive - rm /var/www/$3/htdocs/latest.tar.gz + rm /var/www/$Domain/htdocs/latest.tar.gz # Modify wp-config.php + # Change Ownership + chown -R www-data:www-data /var/www/$Domain/ fi