You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1625 lines
39 KiB
1625 lines
39 KiB
#!/bin/bash
|
|
|
|
|
|
|
|
# Make Variables Available For Later Use
|
|
LOGDIR=/var/log/easyengine
|
|
ERRORLOG=/var/log/easyengine/error.log
|
|
|
|
# Check Auto Assume Yes Or No To Apt-Get
|
|
grep apt-get-assume-yes /etc/easyengine/ee.conf | grep -i true &>> /dev/null
|
|
if [ $? -eq 0 ]
|
|
then
|
|
EEAPTGET="apt-get -y"
|
|
else
|
|
EEAPTGET="apt-get"
|
|
fi
|
|
|
|
|
|
# Capture Errors
|
|
OwnError()
|
|
{
|
|
echo -e "[ `date` ] \033[31m $@ \e[0m" | tee -ai $ERRORLOG
|
|
exit 101
|
|
}
|
|
|
|
# Install Package Functions
|
|
PYTHONSOFTWARE()
|
|
{
|
|
# Install Python Software Properties
|
|
echo -e "\033[34m Installing Python Software Properties... \e[0m"
|
|
sudo $EEAPTGET install python-software-properties \
|
|
|| OwnError "Unable To Install Python Software Properties"
|
|
}
|
|
|
|
NGINXREPO()
|
|
{
|
|
# Add Nginx Launchpad Repository
|
|
echo -e "\033[34m Adding Brianmercer Nginx Launchpad Repository... \e[0m"
|
|
sudo add-apt-repository ppa:brianmercer/nginx \
|
|
|| OwnError "Unable To Add Nginx Launchpad Repository"
|
|
}
|
|
|
|
PHPREPO()
|
|
{
|
|
# Add PHP Launchpad Repository
|
|
echo -e "\033[34m Adding PHP5 Launchpad Repository... \e[0m"
|
|
sudo add-apt-repository ppa:ondrej/php5 \
|
|
|| OwnError "Unable To Add PHP5 Launchpad Repository"
|
|
}
|
|
|
|
PHPMYADMINREPO()
|
|
{
|
|
# Add phpMyAdmin Launchpad Repository
|
|
echo -e "\033[34m Adding phpMyAdmin Launchpad Repository... \e[0m"
|
|
sudo add-apt-repository ppa:nijel/phpmyadmin \
|
|
|| OwnError "Unable To Add phpMyAdmin Launchpad Repository"
|
|
}
|
|
|
|
GPGKEY()
|
|
{
|
|
# Force GPG KEYS Check
|
|
grep gpg-keys-fix /etc/easyengine/ee.conf | grep -i true &>> /dev/null
|
|
|
|
if [ $? -eq 0 ]
|
|
then
|
|
# Fix GPG Key Problems
|
|
echo -e "\033[34m Checking GPG Keys For Brianmercer Nginx Repository... \e[0m"
|
|
sudo apt-get update > /dev/null 2> /tmp/keymissing \
|
|
|| OwnError "Unable To Fix GPG Keys For Brianmercer Nginx Repository "
|
|
|
|
for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //")
|
|
do
|
|
echo -e "\033[34m Processing key: $key \e[0m"
|
|
gpg --keyserver subkeys.pgp.net --recv $key && sudo gpg --export --armor $key | apt-key add -
|
|
done
|
|
fi
|
|
}
|
|
|
|
UPDATEAPT()
|
|
{
|
|
# Update The APT Cache
|
|
echo -e "\033[34m Updating APT Cache... \e[0m"
|
|
sudo apt-get update || OwnError "Unable To Update APT Cache"
|
|
}
|
|
|
|
INSTALLNGINX()
|
|
{
|
|
# Install Nginx
|
|
echo -e "\033[34m Installing Nginx... \e[0m"
|
|
sudo $EEAPTGET install nginx-custom || OwnError "Unable To Install Nginx"
|
|
}
|
|
|
|
COMMONNGINX()
|
|
{
|
|
# Personal Settings For Nginx
|
|
echo -e "\033[34m Updating Nginx Configuration Files... \e[0m"
|
|
|
|
# Check Directory Exist
|
|
if [ ! -d /etc/nginx/conf.d ]
|
|
then
|
|
mkdir /etc/nginx/conf.d || OwnError "Unable To Create /etc/nginx/conf.d"
|
|
fi
|
|
|
|
if [ ! -d /etc/nginx/common ]
|
|
then
|
|
mkdir /etc/nginx/common || OwnError "Unable To Create /etc/nginx/common"
|
|
fi
|
|
|
|
# Update Nginx Configuration Files
|
|
cp -v /usr/share/easyengine/nginx/conf.d/* /etc/nginx/conf.d/ \
|
|
|| OwnError "Unable To Copy Nginx Configuration Files"
|
|
|
|
# Update Nginx Common Files
|
|
cp -v /usr/share/easyengine/nginx/common/* /etc/nginx/common/ \
|
|
|| OwnError "Unable To Copy Nginx Common Files"
|
|
}
|
|
|
|
INSTALLPHP()
|
|
{
|
|
# Install PHP5
|
|
echo -e "\033[34m Installing PHP5... \e[0m"
|
|
sudo $EEAPTGET install php5-common php5-mysqlnd php5-xmlrpc \
|
|
php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \
|
|
php5-dev php5-imap php5-mcrypt || OwnError "Unable To Install PHP5"
|
|
}
|
|
|
|
CHANGEPHPSOCKET()
|
|
{
|
|
# Change PHP Fastcgi Socket
|
|
echo -e "\033[34m Change PHP Fastcgi Socket... \e[0m"
|
|
sed -i "s'listen = /var/run/php5-fpm.sock'listen = 127.0.0.1:9000'" /etc/php5/fpm/pool.d/www.conf \
|
|
|| OwnError "Unable To Change PHP Fastcgi Socket"
|
|
}
|
|
|
|
INSTALLMYSQL()
|
|
{
|
|
# Install MySQL
|
|
echo -e "\033[34m Installing MySQL... \e[0m"
|
|
sudo $EEAPTGET install mysql-server mysqltuner \
|
|
|| OwnError "Unable To Install MySQL"
|
|
}
|
|
|
|
INSTALLPMA()
|
|
{
|
|
# Install PMA
|
|
echo -e "\033[34m Installing PMA... \e[0m"
|
|
sudo $EEAPTGET install phpmyadmin \
|
|
|| OwnError "Unable To Install PMA"
|
|
}
|
|
|
|
INSTALLPOSTFIX()
|
|
{
|
|
# Install Postfix
|
|
echo -e "\033[34m Installing Postfix... \e[0m"
|
|
sudo $EEAPTGET install postfix || OwnError "Unable To Install Postfix"
|
|
}
|
|
|
|
INSTALLALL()
|
|
{
|
|
# Install Nginx PHP5 MySQL Postfix
|
|
echo -e "\033[34m Installing Nginx PHP5 MySQL Postfix... \e[0m"
|
|
sudo $EEAPTGET install nginx-custom php5-common php5-mysqlnd php5-xmlrpc \
|
|
php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \
|
|
php5-dev php5-imap php5-mcrypt mysql-server mysqltuner phpmyadmin postfix \
|
|
|| OwnError "Unable To Install Nginx PHP5 MySQL PMA Postfix"
|
|
}
|
|
|
|
WP-CLI()
|
|
{
|
|
# Install WP-CLI
|
|
if [ ! -d /usr/share/easyengine/wp-cli ]
|
|
then
|
|
echo -e "\033[31m WP Command Not Found ! \e[0m"
|
|
echo -e "\033[34m Installing WP-CLI, Please Wait... \e[0m"
|
|
curl http://wp-cli.org/installer.sh | INSTALL_DIR='/usr/share/easyengine/wp-cli' bash \
|
|
|| OwnError "Unable To Install WP-CLI"
|
|
|
|
# Add WP Command In PATH Variable
|
|
ln -s /usr/share/easyengine/wp-cli/bin/wp /usr/bin/wp || OwnError "Unable To Create Symbolic Link For WP Command"
|
|
|
|
# Add WP Auto Completion
|
|
cp -v /usr/share/easyengine/wp-cli/vendor/wp-cli/wp-cli/utils/wp-completion.bash /etc/bash_completion.d/
|
|
source /etc/bash_completion.d/wp-completion.bash
|
|
fi
|
|
}
|
|
|
|
|
|
# Remove Package Functions
|
|
REMOVENGINX()
|
|
{
|
|
# Remove Nginx
|
|
echo -e "\033[34m Removing Nginx... \e[0m"
|
|
sudo $EEAPTGET remove nginx-custom || OwnError "Unable To Remove Nginx"
|
|
}
|
|
|
|
REMOVEPHP()
|
|
{
|
|
# Remove PHP5
|
|
echo -e "\033[34m Removing PHP5... \e[0m"
|
|
sudo $EEAPTGET remove php5-common php5-mysqlnd php5-xmlrpc \
|
|
php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \
|
|
php5-dev php5-imap php5-mcrypt || OwnError "Unable To Remove PHP5"
|
|
}
|
|
|
|
REMOVEMYSQL()
|
|
{
|
|
# Remove MySQL
|
|
echo -e "\033[34m Removing MySQL... \e[0m"
|
|
sudo $EEAPTGET remove mysql-server mysqltuner \
|
|
|| OwnError "Unable To Remove MySQL"
|
|
}
|
|
|
|
REMOVEPMA()
|
|
{
|
|
# Remove PMA
|
|
echo -e "\033[34m Installing PMA... \e[0m"
|
|
sudo $EEAPTGET remove phpmyadmin \
|
|
|| OwnError "Unable To Remove PMA"
|
|
}
|
|
|
|
REMOVEPOSTFIX()
|
|
{
|
|
# Remove Postfix
|
|
echo -e "\033[34m Removing Postfix... \e[0m"
|
|
sudo $EEAPTGET remove postfix || OwnError "Unable To Remove Postfix"
|
|
}
|
|
|
|
REMOVEALL()
|
|
{
|
|
# Remove Nginx PHP5 MySQL Postfix
|
|
echo -e "\033[34m Removing Nginx PHP5 MySQL Postfix... \e[0m"
|
|
sudo $EEAPTGET remove nginx-custom php5-common php5-mysqlnd php5-xmlrpc \
|
|
php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \
|
|
php5-dev php5-imap php5-mcrypt mysql-server mysqltuner phpmyadmin postfix \
|
|
|| OwnError "Unable To Remove Nginx PHP5 MySQL PMA Postfix"
|
|
}
|
|
|
|
REMOVEWPCLI()
|
|
{
|
|
# Remove WP-CLI
|
|
echo -e "\033[34m Removing WP-CLI... \e[0m"
|
|
sudo rm -rf /var/www/wp-cli || OwnError "Unable To Remove WP-CLI"
|
|
}
|
|
|
|
AUTOREMOVE()
|
|
{
|
|
# Remove Unwanted Packages
|
|
echo -e "\033[34m Removing Unwanted Packages... \e[0m"
|
|
sudo $EEAPTGET autoremove || OwnError "Unable To Auto Remove"
|
|
}
|
|
|
|
|
|
# Purge Package Functions
|
|
PURGENGINX()
|
|
{
|
|
# Purge Nginx
|
|
echo -e "\033[34m Purge Nginx... \e[0m"
|
|
sudo $EEAPTGET purge nginx-custom || OwnError "Unable To Purge Nginx"
|
|
}
|
|
|
|
PURGEPHP()
|
|
{
|
|
# Purge PHP5
|
|
echo -e "\033[34m Purge PHP5... \e[0m"
|
|
sudo $EEAPTGET purge php5-common php5-mysqlnd php5-xmlrpc \
|
|
php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \
|
|
php5-dev php5-imap php5-mcrypt || OwnError "Unable To Purge PHP5"
|
|
}
|
|
|
|
PURGEMYSQL()
|
|
{
|
|
# Purge MySQL
|
|
echo -e "\033[34m Purge MySQL... \e[0m"
|
|
sudo $EEAPTGET purge mysql-server mysqltuner \
|
|
|| OwnError "Unable To Purge MySQL"
|
|
}
|
|
|
|
PURGEPMA()
|
|
{
|
|
# Purge PMA
|
|
echo -e "\033[34m Installing PMA... \e[0m"
|
|
sudo $EEAPTGET purge phpmyadmin \
|
|
|| OwnError "Unable To Purge PMA"
|
|
}
|
|
|
|
PURGEPOSTFIX()
|
|
{
|
|
# Purge Postfix
|
|
echo -e "\033[34m Purge Postfix... \e[0m"
|
|
sudo $EEAPTGET purge postfix || OwnError "Unable To Purge Postfix"
|
|
}
|
|
|
|
PURGEALL()
|
|
{
|
|
# Purge Nginx PHP5 MySQL Postfix
|
|
echo -e "\033[34m Removing Nginx PHP5 MySQL Postfix... \e[0m"
|
|
sudo $EEAPTGET purge nginx-custom php5-common php5-mysqlnd php5-xmlrpc \
|
|
php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \
|
|
php5-dev php5-imap php5-mcrypt mysql-server mysqltuner phpmyadmin postfix \
|
|
|| OwnError "Unable To Purge Nginx PHP5 MySQL PMA Postfix"
|
|
}
|
|
|
|
|
|
# EE GIT Function
|
|
EEGITINIT()
|
|
{
|
|
# Initialise Git
|
|
echo -e "\033[34m Initialise Git On $EEGITDIR... \e[0m"
|
|
cd $EEGITDIR || OwnError "Unable To Change Directory $EEGITDIR"
|
|
git init || OwnError "Unable To Initialise Git On $EEGITDIR"
|
|
git add . && git commit -am "Initialise Git On $EEGITDIR" \
|
|
|| OwnError "Unable To Git Commit On $EEGITDIR"
|
|
}
|
|
|
|
EEGITCOMMIT()
|
|
{
|
|
cd $EEGITDIR || OwnError "Unable To Change Directory $EEGITDIR"
|
|
git status | grep --color=auto clean
|
|
|
|
if [ $? -ne 0 ]
|
|
then
|
|
# Git Commit Functionality
|
|
echo -e "\033[34m Take $GITDIR Configuration In Git Version Control... \e[0m"
|
|
|
|
# Add Newly Created Files && Commit It
|
|
git add . && git commit -am "$EEGITMESSAGE" \
|
|
|| OwnError "Unable To Git Commits On $EEGITDIR"
|
|
fi
|
|
}
|
|
|
|
|
|
# GET Information Function
|
|
MYSQLINFO()
|
|
{
|
|
# Get The MySQL Username/Password
|
|
read -p "MySQL Host [localhost]: " MYSQLHOST
|
|
|
|
if [ -f ~/.my.cnf ]
|
|
then
|
|
MYSQLUSER=$(cat ~/.my.cnf | grep user | cut -d'=' -f2)
|
|
MYSQLPASS=$(cat ~/.my.cnf | grep pass | cut -d'=' -f2)
|
|
else
|
|
read -p "Enter The MySQL Username: " MYSQLUSER
|
|
|
|
# Turn Off Echo For Passwords
|
|
stty -echo
|
|
read -p "Enter The MySQL Password: " MYSQLPASS
|
|
stty echo
|
|
echo
|
|
fi
|
|
|
|
read -p "Enter The MySQL Database Name [$DOMAIN]: " WPDBNAME
|
|
read -p "Enter The MySQL Database Table Prefix [wp_]: " WPDBPREFIX
|
|
|
|
# Display WPDBPREFIX Valid Characters Warning & Try Again
|
|
while [ $(echo $WPDBPREFIX | grep '[^[:alnum:] _]') ]
|
|
do
|
|
echo -e "\033[31m Warning: \033[34mTable Prefix Can Only Contain Numbers, Letters, And Underscores. \e[0m"
|
|
read -p "Enter The MySQL Database Table Prefix [wp_]: " WPDBPREFIX
|
|
done
|
|
|
|
# If Enter Is Pressed, Then Use localhost as MySQL Host
|
|
if [[ $MYSQLHOST = "" ]]
|
|
then
|
|
MYSQLHOST=localhost
|
|
#echo $MYSQLHOST
|
|
fi
|
|
|
|
# If Enter Is Pressed, Then Use $DOMAIN As Database Name
|
|
if [[ $WPDBNAME = "" ]]
|
|
then
|
|
WPDBNAME=$DOMAIN
|
|
#echo $WPDBNAME
|
|
fi
|
|
|
|
# If Enter Is Pressed, Then Use wp_ As Database Table Prefix
|
|
if [[ $WPDBPREFIX = "" ]]
|
|
then
|
|
WPDBPREFIX=wp_
|
|
#echo $WPDBPREFIX
|
|
fi
|
|
|
|
# Create Database
|
|
mysql -u $MYSQLUSER -p$MYSQLPASS -e "create database \`$WPDBNAME\`" \
|
|
|| OwnError "Unable To Create $WPDBNAME Database"
|
|
}
|
|
|
|
NGINXUSERINFO()
|
|
{
|
|
# Nginx User
|
|
NGINXUSER=$(grep user /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) \
|
|
|| OwnError "Unable To Findout Nginx Username"
|
|
}
|
|
|
|
NGINXRELOAD()
|
|
{
|
|
# Reload Nginx Configuration
|
|
echo -e "\033[34m Reloading Nginx Configuration, Please Wait... \e[0m"
|
|
nginx -t && service nginx reload || OwnError "Unable To Reload Nginx"
|
|
}
|
|
|
|
NGINXRESTART()
|
|
{
|
|
# Test & Reload Nginx
|
|
echo -e "\033[34m Restarting Nginx Configuration, Please Wait... \e[0m"
|
|
nginx -t && service nginx restart || OwnError "Unable To Restart Nginx"
|
|
}
|
|
|
|
PHPRESTART()
|
|
{
|
|
# Reload PHP
|
|
echo -e "\033[34m Restarting PHP5-FPM Configuration, Please Wait... \e[0m"
|
|
service php5-fpm restart || OwnError "Unable To Restart PHP5-FPM"
|
|
}
|
|
|
|
|
|
|
|
# EE Domian Functions
|
|
EESITENAME()
|
|
{
|
|
# Check SITENAME Is Empty Or Not
|
|
if [ -z "$SITENAMECHECK" ]
|
|
then
|
|
# Ask Users To Enter Domain Name
|
|
read -p "Enter Domain Name: " SITENAMECHECK
|
|
# Remove http:// https:// & www.
|
|
DOMAIN=$(echo $SITENAMECHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''")
|
|
else
|
|
# Remove http:// https:// & www.
|
|
DOMAIN=$(echo $SITENAMECHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''")
|
|
fi
|
|
}
|
|
|
|
NGINXSYMBOLICLINK()
|
|
{
|
|
# Creating Symbolic Link
|
|
echo -e "\033[34m Creating Symbolic Link For $DOMAIN \e[0m"
|
|
ln -s /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/ \
|
|
|| OwnError "Unable To Create Symbolic Link For $DOMAIN"
|
|
}
|
|
|
|
EEDOMAINSETUP()
|
|
{
|
|
# Creating Website $DOMAIN
|
|
echo -e "\033[34m Creating $DOMAIN, Please Wait... \e[0m"
|
|
sed "s/example.com/$DOMAIN/g" \
|
|
/usr/share/easyengine/nginx/$NGINXCONF \
|
|
> /etc/nginx/sites-available/$DOMAIN \
|
|
|| OwnError "Unable To Create Nginx Configuration File For $DOMAIN"
|
|
|
|
# Creating Symbolic Link
|
|
NGINXSYMBOLICLINK
|
|
|
|
# Creating Htdocs & Logs Directory
|
|
echo -e "\033[34m Creating htdocs & logs Directory \e[0m"
|
|
mkdir -p /var/www/$DOMAIN/htdocs && mkdir -p /var/www/$DOMAIN/logs \
|
|
|| OwnError "Unable To Create htdocs & logs Directory"
|
|
|
|
# Creating Symbolic Links For Logs
|
|
echo -e "\033[34m Creating Symbolic Link For Logs \e[0m"
|
|
ln -s /var/log/nginx/$DOMAIN.access.log /var/www/$DOMAIN/logs/access.log \
|
|
&& ln -s /var/log/nginx/$DOMAIN.error.log /var/www/$DOMAIN/logs/error.log \
|
|
|| OwnError "Unable To Create Symbolic Link For $DOMAIN Logs"
|
|
}
|
|
|
|
EEWPSETUP()
|
|
{
|
|
# Download Latest Wordpress
|
|
echo -e "\033[34m Downloading WordPress, Please Wait... \e[0m"
|
|
wget -cO /var/www/$DOMAIN/htdocs/latest.tar.gz \
|
|
http://wordpress.org/latest.tar.gz \
|
|
|| OwnError "Unable To Download WordPress"
|
|
|
|
# Extracting Wordpress
|
|
tar --strip-components=1 -zxf /var/www/$DOMAIN/htdocs/latest.tar.gz \
|
|
-C /var/www/$DOMAIN/htdocs/ \
|
|
|| OwnError "Unable To Extract WordPress"
|
|
|
|
# Removing Wordpress Archive
|
|
rm /var/www/$DOMAIN/htdocs/latest.tar.gz
|
|
|
|
# Call MYSQLINFO Function For MySQL Values
|
|
MYSQLINFO
|
|
|
|
# Modify wp-config.php & Move Outside The Webroot
|
|
cp -v /var/www/$DOMAIN/htdocs/wp-config-sample.php \
|
|
/var/www/$DOMAIN/wp-config.php
|
|
|
|
sed -i "s/database_name_here/$WPDBNAME/" \
|
|
/var/www/$DOMAIN/wp-config.php
|
|
|
|
sed -i "s/username_here/$MYSQLUSER/" \
|
|
/var/www/$DOMAIN/wp-config.php
|
|
|
|
sed -i "s/password_here/$MYSQLPASS/" \
|
|
/var/www/$DOMAIN/wp-config.php
|
|
|
|
sed -i "s/localhost/$MYSQLHOST/" \
|
|
/var/www/$DOMAIN/wp-config.php
|
|
|
|
sed -i "s/wp_/$WPDBPREFIX/" \
|
|
/var/www/$DOMAIN/wp-config.php
|
|
|
|
printf '%s\n' "g/put your unique phrase here/d" \
|
|
a "$(curl -L https://api.wordpress.org/secret-key/1.1/salt/)" . w \
|
|
| ed -s /var/www/$DOMAIN/wp-config.php
|
|
}
|
|
|
|
EEWPDBSETUP()
|
|
{
|
|
# Get WordPress Site Title
|
|
echo -e "\033[34m WordPress Information Required... \e[0m"
|
|
read -p "Site Title: " SITETITLE
|
|
read -p "Username [admin]: " WPADMINUSER
|
|
|
|
# Turn Off Echo For Passwords
|
|
stty -echo
|
|
read -p "Password: " WPADMINPASS
|
|
stty echo
|
|
|
|
echo
|
|
read -p "Email: " WPADMINEMAIL
|
|
|
|
# If Enter Is Pressed, Then Use admin As WordPress Admin Username
|
|
if [[ $WPADMINUSER = "" ]]
|
|
then
|
|
WPADMINUSER=admin
|
|
#echo $WPADMINUSER
|
|
fi
|
|
|
|
# Create WordPress Tables
|
|
cd /var/www/$DOMAIN/htdocs || OwnError "Unable To Change Directory For WP-CLI"
|
|
wp core install --url=$DOMAIN --title="$SITETITLE" \
|
|
--admin_name=$WPADMINUSER --admin_password=$WPADMINPASS --admin_email=$WPADMINEMAIL \
|
|
|| OwnError "Unable To Create WordPress Tables For $DOMAIN"
|
|
}
|
|
|
|
EEPERMISSION()
|
|
{
|
|
# Call NGINXUSERINFO Function For NGINX User Details
|
|
NGINXUSERINFO
|
|
|
|
# Change Ownership
|
|
echo -e "\033[34m Changing Ownership \e[0m"
|
|
chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/ || OwnError "Unable To Change Ownership For $DOMAIN"
|
|
|
|
# Reload Nginx Configuration
|
|
NGINXRELOAD
|
|
}
|
|
|
|
|
|
# NGINX Configuration Function
|
|
SETUPDOMAIN()
|
|
{
|
|
# Check SITENAME Is Empty Or Not
|
|
EESITENAME
|
|
|
|
# Creating Website $DOMAIN
|
|
EEDOMAINSETUP
|
|
|
|
# Setup WordPress Webroot & Database
|
|
EEWPSETUP
|
|
EEWPDBSETUP
|
|
}
|
|
|
|
PERMISSIONANDGIT()
|
|
{
|
|
# Change Webroot Permission
|
|
EEPERMISSION
|
|
|
|
# Take Nginx Configuration In Git Version Control
|
|
EEGITDIR=/etc/nginx
|
|
EEGITMESSAGE="Created New $WPNETWORKSITE $WPCACHEOPTION Website: $DOMAIN"
|
|
EEGITCOMMIT
|
|
}
|
|
|
|
TOTALCACHENGINX()
|
|
{
|
|
# Installing W3 Total Cache
|
|
cd /var/www/$DOMAIN/htdocs/
|
|
echo -e "\033[34m Installing W3 Total Cache Plugin, Please Wait... \e[0m"
|
|
wp plugin install w3-total-cache || OwnError "Unable To Install W3 Total Cache Plugin"
|
|
|
|
# Activate W3 Total Cache
|
|
wp plugin activate w3-total-cache $NETWORKACTIVATE || OwnError "Unable To Activate W3 Total Cache Plugin"
|
|
|
|
# APC Settings
|
|
cp -v /usr/share/doc/php-apc/apc.php /var/www/$DOMAIN/htdocs/ || OwnError "Unable To Copy APC"
|
|
}
|
|
|
|
SUPERCACHENGINX()
|
|
{
|
|
# Installing WP Super Cache
|
|
cd /var/www/$DOMAIN/htdocs/
|
|
echo -e "\033[34m Installing WP Super Cache Plugin, Please Wait... \e[0m"
|
|
wp plugin install wp-super-cache || OwnError "Unable To Install WP Super Cache Plugin"
|
|
|
|
# Activate WP Super Cache
|
|
wp plugin activate wp-super-cache $NETWORKACTIVATE || OwnError "Unable To Activate WP Super Cache Plugin"
|
|
}
|
|
|
|
NGINXHELPER()
|
|
{
|
|
# Installing Nginx Helper
|
|
cd /var/www/$DOMAIN/htdocs/
|
|
echo -e "\033[34m Installing Nginx Helper Plugin, Please Wait... \e[0m"
|
|
wp plugin install nginx-helper || OwnError "Unable To Install Nginx Helper"
|
|
|
|
# Activate Nginx Helper
|
|
wp plugin activate nginx-helper $NETWORKACTIVATE || OwnError "Unable To Activate Nginx Helper Plugin"
|
|
}
|
|
|
|
|
|
# Setup Wordpress Network
|
|
SETUPWPNETWORK()
|
|
{
|
|
# Prepare wp-config.php File Foe Wordpress Multisite With SubDirectory
|
|
cd /var/www/$DOMAIN/htdocs || OwnError "Unable To Change Directory"
|
|
wp core install-network --title="$SITETITLE" $WPSUBDOMAINS || OwnError "Unable To Setup WordPress SubDirectory Network"
|
|
|
|
sed -i "/WP_DEBUG/a \define('WP_ALLOW_MULTISITE', true);" /var/www/$DOMAIN/wp-config.php
|
|
sed -i "/WP_ALLOW_MULTISITE/a \define('WPMU_ACCEL_REDIRECT', true);" /var/www/$DOMAIN/wp-config.php
|
|
|
|
# Remove index.php from permalink
|
|
# Install Nginx Helper
|
|
NGINXHELPER
|
|
}
|
|
|
|
|
|
# Remove Database
|
|
REMOVEDB()
|
|
{
|
|
# MySQL Informatiom
|
|
WPDBNAME=$(grep DB_NAME /var/www/$DOMAIN/wp-config.php | cut -d"'" -f4)
|
|
MYSQLUSER=$(grep DB_USER /var/www/mitesh.com/wp-config.php | cut -d"'" -f4)
|
|
MYSQLPASS=$(grep DB_PASS /var/www/mitesh.com/wp-config.php | cut -d"'" -f4)
|
|
echo -e " WPDBNAME = $WPDBNAME \n MYSQLUSER = $MYSQLUSER \n MYSQLPASS = $MYSQLPASS"
|
|
|
|
# Remove Database
|
|
echo
|
|
read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER
|
|
|
|
if [ "$ANSWER" = "y" ]
|
|
then
|
|
# Remove Database
|
|
mysql -u $MYSQLUSER -p$MYSQLPASS -e "drop database \`$WPDBNAME\`" \
|
|
|| OwnError "Unable To Drop $WPDBNAME Database"
|
|
else
|
|
# User Denied Messages
|
|
echo -e "\033[31m User Denied To Drop $WPDBNAME Database. \e[0m"
|
|
fi
|
|
}
|
|
|
|
REMOVEFILES()
|
|
{
|
|
# Remove Webroot
|
|
echo
|
|
read -p "Are You Sure To Remove $DOMAIN Webroot (y/n): " ANSWER
|
|
|
|
if [ "$ANSWER" = "y" ]
|
|
then
|
|
# Remove Webroot
|
|
rm -rf /var/www/$DOMAIN || OwnError "Unable To Remove $DOMAIN Webroot"
|
|
else
|
|
# User Denied Messages
|
|
echo -e "\033[31m User Denied To Remove $DOMAIN Webroot. \e[0m"
|
|
fi
|
|
}
|
|
|
|
REMOVENGINXCONF()
|
|
{
|
|
# Remove Nginx Configuraion
|
|
echo
|
|
read -p "Are You Sure To Remove $DOMAIN Nginx Configuraion (y/n): " ANSWER
|
|
|
|
if [ "$ANSWER" = "y" ]
|
|
then
|
|
# Remove Webroot
|
|
rm -rf /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/$DOMAIN \
|
|
|| OwnError "Unable To Remove $DOMAIN Nginx Configuration"
|
|
else
|
|
# User Denied Messages
|
|
echo -e "\033[31m User Denied To Remove $DOMAIN Nginx Configuration. \e[0m"
|
|
fi
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine System Settings
|
|
if [ "$1" = "system" ]
|
|
then
|
|
|
|
|
|
# Easy Engine Install
|
|
if [ "$2" = "install" ]
|
|
then
|
|
|
|
if [ "$3" = "nginx" ]
|
|
then
|
|
|
|
# Install Python Software Properties
|
|
PYTHONSOFTWARE
|
|
|
|
# Add Nginx Launchpad Repository
|
|
NGINXREPO
|
|
|
|
# Fix GPG Key Problems
|
|
GPGKEY
|
|
|
|
# Update The APT Cache
|
|
UPDATEAPT
|
|
|
|
# Install Nginx
|
|
INSTALLNGINX
|
|
|
|
# Personal Settings For Nginx
|
|
COMMONNGINX
|
|
|
|
# Restart Nginx To Take Effect Of COMMONNGINX Functions
|
|
NGINXRESTART
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/nginx/
|
|
EEGITINIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Nginx Successfully Installed \e[0m"
|
|
|
|
elif [ "$3" = "php" ]
|
|
then
|
|
|
|
# Install Python Software Properties
|
|
PYTHONSOFTWARE
|
|
|
|
# Add PHP Launchpad Repository
|
|
PHPREPO
|
|
|
|
# Fix GPG Key Problems
|
|
GPGKEY
|
|
|
|
# Update The APT Cache
|
|
UPDATEAPT
|
|
|
|
# Install PHP5
|
|
INSTALLPHP
|
|
|
|
# Change PHP Fastcgi Socket
|
|
CHANGEPHPSOCKET
|
|
|
|
## Reload PHP To Take Effect Of CHANGEPHPSOCKET Functions
|
|
PHPRESTART
|
|
|
|
# Install WP-CLI
|
|
WP-CLI
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/php5/
|
|
EEGITINIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m PHP5 Successfully Installed \e[0m"
|
|
|
|
elif [ "$3" = "mysql" ]
|
|
then
|
|
|
|
# Update The APT Cache
|
|
UPDATEAPT
|
|
|
|
# Install MySQL
|
|
INSTALLMYSQL
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/mysql/
|
|
EEGITINIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m MySQL Successfully Installed \e[0m"
|
|
|
|
elif [ "$3" = "pma" ]
|
|
then
|
|
|
|
# Install Python Software Properties
|
|
PYTHONSOFTWARE
|
|
|
|
# Add phpMyAdmin Launchpad Repository
|
|
PHPMYADMINREPO
|
|
|
|
# Update The APT Cache
|
|
UPDATEAPT
|
|
|
|
# Install PMA
|
|
INSTALLPMA
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/phpmyadmin/
|
|
EEGITINIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m PMA Successfully Installed \e[0m"
|
|
|
|
elif [ "$3" = "postfix" ]
|
|
then
|
|
|
|
# Update The APT Cache
|
|
UPDATEAPT
|
|
|
|
# Install Postfix
|
|
INSTALLPOSTFIX
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/postfix/
|
|
EEGITINIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Postfix Successfully Installed \e[0m"
|
|
|
|
elif [ "$3" = "all" ]
|
|
then
|
|
|
|
# Install Python Software Properties
|
|
PYTHONSOFTWARE
|
|
|
|
# Add Nginx Launchpad Repository
|
|
NGINXREPO
|
|
|
|
# Add PHP Launchpad Repository
|
|
PHPREPO
|
|
|
|
# Add phpMyAdmin Launchpad Repository
|
|
PHPMYADMINREPO
|
|
|
|
# Fix GPG Key Problems
|
|
GPGKEY
|
|
|
|
# Update The APT Cache
|
|
UPDATEAPT
|
|
|
|
# Install Nginx PHP5 MySQL PMA Postfix
|
|
INSTALLALL
|
|
|
|
# Personal Settings For Nginx
|
|
COMMONNGINX
|
|
|
|
# Reload Nginx To Take Effect Of COMMONNGINX Functions
|
|
NGINXRESTART
|
|
|
|
# Change PHP Fastcgi Socket
|
|
CHANGEPHPSOCKET
|
|
|
|
## Reload PHP To Take Effect Of CHANGEPHPSOCKET Functions
|
|
PHPRESTART
|
|
|
|
# Install WP-CLI
|
|
WP-CLI
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/nginx/
|
|
EEGITINIT
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/php5/
|
|
EEGITINIT
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/mysql/
|
|
EEGITINIT
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/phpmyadmin/
|
|
EEGITINIT
|
|
|
|
# Initialise Git
|
|
EEGITDIR=/etc/postfix/
|
|
EEGITINIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Nginx PHP5 MySQL PMA Postfix Successfully Installed \e[0m"
|
|
|
|
fi
|
|
|
|
|
|
# Easy Engine Remove
|
|
elif [ "$2" = "remove" ]
|
|
then
|
|
|
|
if [ "$3" = "nginx" ]
|
|
then
|
|
|
|
# Remove Nginx
|
|
REMOVENGINX
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Nginx Successfully Removed \e[0m"
|
|
|
|
elif [ "$3" = "php" ]
|
|
then
|
|
|
|
# Remove PHP5
|
|
REMOVEPHP
|
|
REMOVEWPCLI
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m PHP5 Successfully Removed \e[0m"
|
|
|
|
elif [ "$3" = "mysql" ]
|
|
then
|
|
|
|
# Remove MySQL
|
|
REMOVEMYSQL
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m MySQL Successfully Removed \e[0m"
|
|
|
|
elif [ "$3" = "pma" ]
|
|
then
|
|
|
|
# Remove PMA
|
|
REMOVEPMA
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m PMA Successfully Removed \e[0m"
|
|
|
|
elif [ "$3" = "postfix" ]
|
|
then
|
|
|
|
# Remove Postfix
|
|
REMOVEPOSTFIX
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Postfix Successfully Removed \e[0m"
|
|
|
|
elif [ "$3" = "all" ]
|
|
then
|
|
|
|
# Remove Nginx PHP5 MySQL Postfix
|
|
REMOVEALL
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
REMOVEWPCLI
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Nginx PHP5 MySQL PMA Postfix Successfully Removed \e[0m"
|
|
|
|
fi
|
|
|
|
|
|
# Easy Engine Purge
|
|
elif [ "$2" = "purge" ]
|
|
then
|
|
|
|
if [ "$3" = "nginx" ]
|
|
then
|
|
|
|
# Purge Nginx
|
|
PURGENGINX
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Nginx Successfully Purged \e[0m"
|
|
|
|
elif [ "$3" = "php" ]
|
|
then
|
|
|
|
# Purge PHP5
|
|
PURGEPHP
|
|
REMOVEWPCLI
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m PHP5 Successfully Purged \e[0m"
|
|
|
|
elif [ "$3" = "mysql" ]
|
|
then
|
|
|
|
# Purge MySQL
|
|
PURGEMYSQL
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m MySQL Successfully Purged \e[0m"
|
|
|
|
elif [ "$3" = "pma" ]
|
|
then
|
|
|
|
# Purge PMA
|
|
PURGEPMA
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m PMA Successfully Purged \e[0m"
|
|
|
|
elif [ "$3" = "postfix" ]
|
|
then
|
|
|
|
# Purge Postfix
|
|
PURGEPOSTFIX
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Postfix Successfully Purged \e[0m"
|
|
|
|
elif [ "$3" = "all" ]
|
|
then
|
|
|
|
# Purge Nginx PHP5 MySQL Postfix
|
|
PURGEALL
|
|
REMOVEWPCLI
|
|
|
|
# Remove Unwanted Packages
|
|
AUTOREMOVE
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m Nginx PHP5 MySQL PMA Postfix Successfully Purged \e[0m"
|
|
|
|
fi
|
|
|
|
|
|
# Easy Engine Config
|
|
elif [ "$2" = "config" ]
|
|
then
|
|
|
|
if [ "$3" = "set" ]
|
|
then
|
|
|
|
echo "Under Developments"
|
|
|
|
elif [ "$3" = "get" ]
|
|
then
|
|
|
|
echo "Under Developments"
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine Site Settings
|
|
elif [ "$1" = "site" ]
|
|
then
|
|
|
|
# Easy Engine Site Enabled List
|
|
if [ "$2" = "list" ]
|
|
then
|
|
|
|
# Display The List Of Enabled Websites
|
|
echo -e "\033[34m Display The List Of Enabled Websites: \e[0m"
|
|
ls /etc/nginx/sites-enabled/ \
|
|
|| OwnError "Unable To Display The List Of Enabled Websites"
|
|
|
|
elif [ "$2" = "listall" ]
|
|
then
|
|
|
|
# Display The List Of Available Sites
|
|
echo -e "\033[34m Display The List Of Available Websites: \e[0m"
|
|
ls /etc/nginx/sites-available/ \
|
|
|| OwnError "Unable To Display The List Of Available Websites"
|
|
|
|
elif [ "$2" = "show" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$3
|
|
EESITENAME
|
|
|
|
# Check The Website Is Exist
|
|
ls /etc/nginx/sites-available/$DOMAIN &> /dev/null \
|
|
|| OwnError "The $DOMAIN Is Not Found In Available Websites List"
|
|
|
|
if [ $? -eq 0 ]
|
|
then
|
|
|
|
# Display The Specific Site Configuration
|
|
echo -e "\033[34m Display Nginx Configuration For $DOMAIN \e[0m"
|
|
cat /etc/nginx/sites-available/$DOMAIN \
|
|
|| OwnError "Unable To Display Nginx Configuration For $DOMAIN"
|
|
|
|
fi
|
|
|
|
elif [ "$2" = "info" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$3
|
|
EESITENAME
|
|
|
|
# Check The Website Is Exist
|
|
ls /etc/nginx/sites-available/$DOMAIN &> /dev/null \
|
|
|| OwnError "The $DOMAIN Is Not Found In Available Websites List"
|
|
|
|
if [ $? -eq 0 ]
|
|
then
|
|
|
|
# Display The Various Information About $DOMAIN
|
|
echo -e "\033[34m Display The Various Information About $DOMAIN \e[0m"
|
|
echo -e "\033[34m Under Developments \e[0m"
|
|
|
|
fi
|
|
|
|
elif [ "$2" = "create" ]
|
|
then
|
|
|
|
if [ "$3" = "html" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$4
|
|
EESITENAME
|
|
|
|
# Creating Website $DOMAIN
|
|
NGINXCONF=html/basic.conf
|
|
EEDOMAINSETUP
|
|
EEPERMISSION
|
|
|
|
# Take Nginx Configuration In Git Version Control
|
|
EEGITDIR=/etc/nginx
|
|
EEGITMESSAGE="Created New $3 Website: $DOMAIN"
|
|
EEGITCOMMIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m http://$DOMAIN Domain Successfully Created \e[0m"
|
|
|
|
elif [ "$3" = "php" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$4
|
|
EESITENAME
|
|
|
|
# Creating Website $DOMAIN
|
|
NGINXCONF=wpsingle/basic.conf
|
|
EEDOMAINSETUP
|
|
EEPERMISSION
|
|
|
|
# Take Nginx Configuration In Git Version Control
|
|
EEGITDIR=/etc/nginx
|
|
EEGITMESSAGE="Created New $3 Website: $DOMAIN"
|
|
EEGITCOMMIT
|
|
|
|
# Display Success Message
|
|
echo -e "\033[34m http://$DOMAIN Domain Successfully Created \e[0m"
|
|
|
|
elif [ "$3" = "wpsingle" ]
|
|
then
|
|
|
|
if [ "$4" = "basic" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/basic.conf
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Basic Nginx
|
|
SETUPDOMAIN
|
|
PERMISSIONANDGIT
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "w3tc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/w3tc.conf
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup W3 Total Cahe Nginx
|
|
SETUPDOMAIN
|
|
TOTALCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/admin.php?page=w3tc_general \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "wpsc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/wpsc.conf
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup WP Super Cahe Nginx
|
|
SETUPDOMAIN
|
|
SUPERCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m WP Super Cache: http://$DOMAIN/wp-admin/options-general.php?page=wpsupercache \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "wpfc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/wpfc.conf
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Fastcgi Cahe Nginx
|
|
SETUPDOMAIN
|
|
NGINXHELPER
|
|
TOTALCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m Nginx Helper: http://$DOMAIN/wp-admin/options-general.php?page=nginx \e[0m"
|
|
echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/admin.php?page=w3tc_general \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
fi
|
|
|
|
elif [ "$3" = "wpsubdir" ]
|
|
then
|
|
|
|
if [ "$4" = "basic" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/basic.conf
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "w3tc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/w3tc.conf
|
|
NETWORKACTIVATE="--network"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
TOTALCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/network/admin.php?page=w3tc_general \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "wpsc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/wpsc.conf
|
|
NETWORKACTIVATE="--network"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
SUPERCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m WP Super Cache: http://$DOMAIN/wp-admin/network/settings.php?page=wpsupercache \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "wpfc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/wpfc.conf
|
|
NETWORKACTIVATE="--network"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
TOTALCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m Nginx Helper: http://$DOMAIN/wp-admin/network/settings.php?page=nginx \e[0m"
|
|
echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/network/admin.php?page=w3tc_general \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
fi
|
|
|
|
elif [ "$3" = "wpsubdomain" ]
|
|
then
|
|
|
|
if [ "$4" = "basic" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/basic.conf
|
|
WPSUBDOMAINS="--subdomains"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "w3tc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/w3tc.conf
|
|
WPSUBDOMAINS="--subdomains"
|
|
NETWORKACTIVATE="--network"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
TOTALCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/network/admin.php?page=w3tc_general \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "wpsc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/wpsc.conf
|
|
WPSUBDOMAINS="--subdomains"
|
|
NETWORKACTIVATE="--network"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
SUPERCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m WP Super Cache: http://$DOMAIN/wp-admin/network/settings.php?page=wpsupercache \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
elif [ "$4" = "wpfc" ]
|
|
then
|
|
|
|
# Congigure Variable
|
|
WPNETWORKSITE=$3
|
|
WPCACHEOPTION=$4
|
|
SITENAMECHECK=$5
|
|
NGINXCONF=$3/wpfc.conf
|
|
WPSUBDOMAINS="--subdomains"
|
|
NETWORKACTIVATE="--network"
|
|
echo -e " WPNETWORKSITE = $WPNETWORKSITE \n WPCACHEOPTION = $WPCACHEOPTION \n SITENAMECHECK = $SITENAMECHECK \n NGINXCONF = $NGINXCONF \n WPSUBDOMAINS = $WPSUBDOMAINS \n NETWORKACTIVATE = $NETWORKACTIVATE"
|
|
|
|
# Setup Domain WordPress & Database
|
|
SETUPDOMAIN
|
|
|
|
# Setup WordPress SubDirectory Network
|
|
SETUPWPNETWORK
|
|
TOTALCACHENGINX
|
|
PERMISSIONANDGIT
|
|
|
|
# Setup phpMyAdmin
|
|
ln -s /usr/share/phpmyadmin /var/www/$DOMAIN/htdocs/
|
|
|
|
# Display WordPress Plugin Configuration Message
|
|
echo
|
|
echo -e "\033[34m Please Configure The Following Settings... \e[0m"
|
|
echo -e "\033[34m Permalink Settings: http://$DOMAIN/wp-admin/options-permalink.php \e[0m"
|
|
echo -e "\033[34m Nginx Helper: http://$DOMAIN/wp-admin/network/settings.php?page=nginx \e[0m"
|
|
echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/network/admin.php?page=w3tc_general \e[0m"
|
|
|
|
# Display Success Message
|
|
echo
|
|
echo -e "\033[34m Successfully Created New $3 $4 Website: http://$DOMAIN \e[0m"
|
|
|
|
fi
|
|
fi
|
|
|
|
elif [ "$2" = "enable" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$3
|
|
EESITENAME
|
|
|
|
# Creating Symbolic Link
|
|
NGINXSYMBOLICLINK
|
|
|
|
# Reload Nginx Configuration
|
|
NGINXRELOAD
|
|
|
|
# Take Nginx Configuration In Git Version Control
|
|
EEGITDIR=/etc/nginx
|
|
EEGITMESSAGE="Enable Website: $DOMAIN"
|
|
EEGITCOMMIT
|
|
|
|
elif [ "$2" = "disable" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$3
|
|
EESITENAME
|
|
|
|
# Remove Symbolic Link
|
|
echo -e "\033[34m Removing Symbolic Link For $DOMAIN \e[0m"
|
|
rm /etc/nginx/sites-enabled/$DOMAIN \
|
|
|| OwnError "Unable To Remove Symbolic Link For $DOMAIN"
|
|
|
|
# Reload Nginx Configuration
|
|
NGINXRELOAD
|
|
|
|
# Take Nginx Configuration In Git Version Control
|
|
EEGITDIR=/etc/nginx
|
|
EEGITMESSAGE="Disable Website: $DOMAIN"
|
|
EEGITCOMMIT
|
|
|
|
elif [ "$2" = "delete" ]
|
|
then
|
|
|
|
# Check SITENAME Is Empty Or Not
|
|
SITENAMECHECK=$4
|
|
EESITENAME
|
|
|
|
if [ "$3" = "db" ]
|
|
then
|
|
|
|
# Remove Database
|
|
REMOVEDB
|
|
|
|
elif [ "$3" = "files" ]
|
|
then
|
|
|
|
# Remove Webroot
|
|
REMOVEFILES
|
|
|
|
elif [ "$3" = "all" ]
|
|
then
|
|
|
|
# Remove All Database And Webroot
|
|
REMOVEDB
|
|
REMOVEFILES
|
|
|
|
# Remove Nginx Configuraion
|
|
REMOVENGINXCONF
|
|
|
|
# Reload Nginx
|
|
NGINXRELOAD
|
|
|
|
# Take Nginx Configuration In Git Version Control
|
|
EEGITDIR=/etc/nginx
|
|
EEGITMESSAGE="Delete Website with $3 Option: $DOMAIN"
|
|
EEGITCOMMIT
|
|
|
|
fi
|
|
|
|
|
|
#elif [ "$2" = "delete" ]
|
|
#then
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine Update
|
|
elif [ "$1" = "update" ]
|
|
then
|
|
|
|
echo -e "\033[34m Updating Easy Engine, Please wait... \e[0m"
|
|
curl -L rt.cx/ee | sudo bash
|
|
|
|
fi
|