set webroot default folder

This commit is contained in:
Jack McNicol
2016-07-22 02:12:13 +09:30
parent e9105d0824
commit 7e58270683

View File

@@ -13,7 +13,10 @@ fi
# Set custom webroot # Set custom webroot
if [ ! -z "$WEBROOT" ]; then if [ ! -z "$WEBROOT" ]; then
sed -i "s#root /var/www/html;#root ${WEBROOT};#g" /etc/nginx/sites-available/default.conf webroot=$WEBROOT
sed -i "s#root /var/www/html;#root ${webroot};#g" /etc/nginx/sites-available/default.conf
else
webroot=/var/www/html
fi fi
# Setup git variables # Setup git variables
@@ -26,15 +29,15 @@ if [ ! -z "$GIT_NAME" ]; then
fi fi
# Dont pull code down if the .git folder exists # Dont pull code down if the .git folder exists
if [ ! -d "/var/www/html/.git" ]; then if [ ! -d "${webroot}/.git" ]; then
# Pull down code from git for our site! # Pull down code from git for our site!
if [ ! -z "$GIT_REPO" ]; then if [ ! -z "$GIT_REPO" ]; then
# Remove the test index file # Remove the test index file
rm -Rf /var/www/html/index.php rm -Rf /var/www/html/index.php
if [ ! -z "$GIT_BRANCH" ]; then if [ ! -z "$GIT_BRANCH" ]; then
git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/ git clone -b $GIT_BRANCH $GIT_REPO $webroot
else else
git clone $GIT_REPO /var/www/html/ git clone $GIT_REPO $webroot
fi fi
chown -Rf nginx.nginx /var/www/html chown -Rf nginx.nginx /var/www/html
fi fi