add color, eliminate extraneous debug msgs
This commit is contained in:
226
install.sh
226
install.sh
@@ -30,195 +30,287 @@ nginxlogloc=$logdir"nginx.log"
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# Installs Dependencies automatically
|
# Installs Dependencies automatically
|
||||||
#TODO: 1. add success outputs to script
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# check if root
|
# check if root
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "This script must be run as root"
|
echo -e "This script must be run as root"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd /root/
|
cd /root/
|
||||||
|
|
||||||
echo "Installing dependencies..."
|
tput setaf 2
|
||||||
|
echo -e "Installing dependencies"
|
||||||
|
tput setaf 0
|
||||||
# create necessary dirs
|
# create necessary dirs
|
||||||
if [ ! -d $logdir ] ; then
|
if [ ! -d $logdir ] ; then
|
||||||
mkdir $logdir
|
mkdir $logdir
|
||||||
fi
|
fi
|
||||||
if [ $install_epel_release = True ] ; then
|
if [ $install_epel_release = True ] ; then
|
||||||
yum -y install epel-release
|
yum -y install epel-release 1>> $yumlogloc 2>> $yumlogloc 3>> $pylogloc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
yum -y -q install gcc wget nginx libsqlite3x-devel.x86_64 postgresql-server postgresql-devel postgresql-contrib bzip2-devel zlib-devel libffi-devel openssl-devel policycoreutils-python.x86_64 >> $yumlogloc
|
echo -e "\tInstalling gcc"
|
||||||
|
yum -y install gcc 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "yum failed to install a dependency. $yumlogmsg"
|
echo -e "yum failed to install gcc. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling wget"
|
||||||
|
yum -y install wget 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install a wget. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling nginx"
|
||||||
|
yum -y install nginx 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install nginx. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling libsqlite3x-devel.x86_64"
|
||||||
|
yum -y install libsqlite3x-devel.x86_64 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install libsqlite3x-devel.x86_64 . $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling postgresql-server"
|
||||||
|
yum -y install postgresql-server 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install postgresql-server. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling postgresql-devel"
|
||||||
|
yum -y install postgresql-devel 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install postgresql-devel. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling postgresql-contrib"
|
||||||
|
yum -y install postgresql-contrib 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install postgresql-contrib. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling bzip2-devel"
|
||||||
|
yum -y install bzip2-devel 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install bzip2-devel. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling zlib-devel"
|
||||||
|
yum -y install zlib-devel 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install zlib-devel. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling ibffi-devel"
|
||||||
|
yum -y install libffi-devel 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install libffi-devel. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling openssl-devel"
|
||||||
|
yum -y install openssl-devel 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install openssl-devel. $yumlogmsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling policycoreutils-python.x86_64"
|
||||||
|
yum -y install policycoreutils-python.x86_64 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "yum failed to install policycoreutils-python.x86_64. $yumlogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set firewall
|
# set firewall
|
||||||
echo "firewall-cmd --zone=public --add-port=80/tcp --permanent" > $firelogloc
|
echo -e "firewall-cmd --zone=public --add-port=80/tcp --permanent" > $firelogloc
|
||||||
firewall-cmd --zone=public --add-port=80/tcp --permanent >> $firelogloc
|
firewall-cmd --zone=public --add-port=80/tcp --permanent >> $firelogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "firewall failed to update port 80 correctly (this may not be an issue). $firelogmsg"
|
echo -e "firewall failed to update port 80 correctly (this may not be an issue). $firelogmsg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "firewall-cmd --zone=public --add-port=443/tcp --permanent" >> $firelogloc
|
echo -e "firewall-cmd --zone=public --add-port=443/tcp --permanent" >> $firelogloc
|
||||||
firewall-cmd --zone=public --add-port=443/tcp --permanent >> $firelogloc
|
firewall-cmd --zone=public --add-port=443/tcp --permanent >> $firelogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "firewall failed to update port 443 correctly, (this may not be an issue). $firelogmsg"
|
echo -e "firewall failed to update port 443 correctly, (this may not be an issue). $firelogmsg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "firewall-cmd --reload" >> $firelogloc
|
echo -e "firewall-cmd --reload" >> $firelogloc
|
||||||
firewall-cmd --reload >> $firelogloc
|
firewall-cmd --reload >> $firelogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "firewall failed to reload, (this may not be an issue). $firelogmsg"
|
echo -e "firewall failed to reload, (this may not be an issue). $firelogmsg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "semanage permissive -a httpd_t" >> $firelogloc
|
echo -e "semanage permissive -a httpd_t" >> $firelogloc
|
||||||
semanage permissive -a httpd_t >> $firelogloc
|
semanage permissive -a httpd_t >> $firelogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "semanage failed to set permissive. See $firelogmsg"
|
echo -e "semanage failed to set permissive. See $firelogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Done."
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Python
|
# Python
|
||||||
# Download and setup Python and modules
|
# Download and setup Python and modules
|
||||||
# TODO: 1.
|
|
||||||
################################################################################
|
################################################################################
|
||||||
echo "Installing python..."
|
tput setaf 2
|
||||||
wget -q $pylink > $pylogloc
|
echo -e "Installing Python"
|
||||||
|
tput setaf 0
|
||||||
|
wget $pylink 1> $pylogloc 2>> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to fetch python, make sure wget is installed and $pylink is what you're after. $pylogmsg"
|
echo -e "Failed to fetch python, make sure wget is installed and $pylink is what you're after. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
tar xf Python-3.7.0.tar.xz >> $pylogloc
|
tar xf Python-3.7.0.tar.xz >> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to unzip python. $pylogmsg"
|
echo -e "Failed to unzip python. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd Python-3.7.0
|
cd Python-3.7.0
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Missing python directory. $pylogmsg"
|
echo -e "Missing python directory. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
./configure --prefix /usr/src/python37 >> $pylogloc
|
echo -e "\tConfigure"
|
||||||
|
./configure --prefix /usr/src/python37 1>> $pylogloc 2>> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "./configure failed. $pylogmsg"
|
echo -e "./configure failed. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
make --quiet >> $pylogloc
|
echo -e "\tMake"
|
||||||
|
make 1>> $pylogloc 2>> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "make failed. $pylogmsg"
|
echo -e "make failed. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
make --quiet altinstall >> $pylogloc
|
echo -e "\tMake altinstall"
|
||||||
|
make altinstall 1>> $pylogloc 2>> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "make altinstall failed. $pylogmsg"
|
echo -e "make altinstall failed. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
/usr/src/python37/bin/python3.7 -m pip install --upgrade pip >> $pylogloc
|
echo -e "\tUpgrading pip"
|
||||||
|
/usr/src/python37/bin/python3.7 -m pip install --upgrade pip 1>> $pylogloc 2>> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "pip upgrade failed. $pylogmsg"
|
echo -e "pip upgrade failed. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
/usr/src/python37/bin/python3.7 -m pip install virtualenv >> $pylogloc
|
echo -e "\tInstalling virtualenv"
|
||||||
|
/usr/src/python37/bin/python3.7 -m pip install virtualenv 1>> $pylogloc 2>> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "installing virtualenv failed. $pylogmsg"
|
echo -e "installing virtualenv failed. $pylogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd /root/
|
cd /root/
|
||||||
rm Python-3.7.0.tar.xz >> $pylogloc
|
rm Python-3.7.0.tar.xz >> $pylogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to remove Python tar file. $pylogmsg"
|
echo -e "Failed to remove Python tar file. $pylogmsg"
|
||||||
fi
|
fi
|
||||||
echo "Done."
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Django
|
# Django
|
||||||
# Download, setup and configure Django
|
# Download, setup and configure Django
|
||||||
# TODO: 1.
|
|
||||||
################################################################################
|
################################################################################
|
||||||
echo "Starting Django project..."
|
tput setaf 2
|
||||||
|
echo -e "Starting Django project"
|
||||||
|
tput setaf 0
|
||||||
if [ ! -d "/home/$user" ] ; then
|
if [ ! -d "/home/$user" ] ; then
|
||||||
mkdir /home/$user
|
mkdir /home/$user
|
||||||
chown -R $user:$user /home/$user
|
chown -R $user:$user /home/$user
|
||||||
fi
|
fi
|
||||||
mkdir /home/$user/$projectname
|
mkdir /home/$user/$projectname
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to create $projectname directory. $djamsg"
|
echo -e "Failed to create $projectname directory. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo -e "\tCreating venv"
|
||||||
cd /home/$user/
|
cd /home/$user/
|
||||||
/usr/src/python37/bin/python3.7 -m virtualenv $projectname/venv >> $djaloglo
|
/usr/src/python37/bin/python3.7 -m virtualenv $projectname/venv 1>> $djalogloc 2>> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to create virtual environment. $djamsg"
|
echo -e "Failed to create virtual environment. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
source $projectname/venv/bin/activate >> $djalogloc
|
source $projectname/venv/bin/activate >> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to source virtual environment. $djamsg"
|
echo -e "Failed to source virtual environment. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
pip install django gunicorn psycopg2-binary >> $djalogloc
|
echo -e "\tInstalling django"
|
||||||
|
pip install django >> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to install pip dependencies. $djamsg"
|
echo -e "Failed to install pip dependencies. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo -e "\tInstalling gunicorn"
|
||||||
|
pip install gunicorn >> $djalogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "Failed to install pip dependencies. $djamsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tInstalling psycopg2-binary"
|
||||||
|
pip install psycopg2-binary >> $djalogloc
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo -e "Failed to install pip dependencies. $djamsg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\tStarting django project"
|
||||||
cd $projectname
|
cd $projectname
|
||||||
django-admin startproject $projectname >> $djalogloc
|
django-admin startproject $projectname >> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to start project $projectname with django-admin. $djamsg"
|
echo -e "Failed to start project $projectname with django-admin. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd /home/$user/
|
cd /home/$user/
|
||||||
echo "echo sed -i 's/ALLOWED_HOSTS = []/ALLOWED_HOSTS = [\"$hostname\"]/' $projectname/$projectname/$projectname/settings.py" >> $djamsg
|
echo -e "echo -e sed -i 's/ALLOWED_HOSTS = []/ALLOWED_HOSTS = [\"$hostname\"]/' $projectname/$projectname/$projectname/settings.py" >> $djalogloc
|
||||||
sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \[\"$hostname\"\]/" $projectname/$projectname/$projectname/settings.py
|
sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \[\"$hostname\"\]/" $projectname/$projectname/$projectname/settings.py
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to change ALLOWED_HOSTS. $djamsg"
|
echo -e "Failed to change ALLOWED_HOSTS. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "echo STATIC_ROOT = os.path.join(BASE_DIR, 'static') >> $projectname/$projectname/$projectname/settings.py"
|
echo -e "echo -e STATIC_ROOT = os.path.join(BASE_DIR, 'static') >> $projectname/$projectname/$projectname/settings.py" >> $djalogloc
|
||||||
echo "STATIC_ROOT = os.path.join(BASE_DIR, 'static')" >> $projectname/$projectname/$projectname/settings.py
|
echo -e "STATIC_ROOT = os.path.join(BASE_DIR, 'static')" >> $projectname/$projectname/$projectname/settings.py
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to append STATIC_ROOT. $djamsg"
|
echo -e "Failed to append STATIC_ROOT. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
python $projectname/$projectname/manage.py collectstatic
|
echo -e "\tCollecting static"
|
||||||
|
python $projectname/$projectname/manage.py collectstatic >> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to collect static files. $djamsg"
|
echo -e "Failed to collect static files. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
python $projectname/$projectname/manage.py makemigrations
|
echo -e "\tMaking migrations"
|
||||||
|
python $projectname/$projectname/manage.py makemigrations >> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to make migrations. $djamsg"
|
echo -e "Failed to make migrations. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
python $projectname/$projectname/manage.py migrate
|
echo -e "\tMigrating"
|
||||||
|
python $projectname/$projectname/manage.py migrate >> $djalogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to migrate. You do not survive the winter. $djamsg"
|
echo -e "Failed to migrate. You do not survive the winter. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
deactivate
|
deactivate
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to deactivate virtual environment, (this may not be an issue). $djamsg"
|
echo -e "Failed to deactivate virtual environment, (this may not be an issue). $djamsg"
|
||||||
fi
|
fi
|
||||||
chown -R $user:$user $projectname
|
chown -R $user:$user $projectname
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to change permissions of $projectname. $djamsg"
|
echo -e "Failed to change permissions of $projectname. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd /root/
|
cd /root/
|
||||||
echo "Done."
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Gunicorn
|
# Gunicorn
|
||||||
# configure gunicorn.conf file
|
# configure gunicorn.conf file
|
||||||
################################################################################
|
################################################################################
|
||||||
echo "Setting up gunicorn..."
|
tput setaf 2
|
||||||
echo "
|
echo -e "Setting up gunicorn"
|
||||||
|
tput setaf 0
|
||||||
|
echo -e "
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=gunicorn daemon
|
Description=gunicorn daemon
|
||||||
After=network.target
|
After=network.target
|
||||||
@@ -231,16 +323,20 @@ ExecStart=/home/$user/$projectname/venv/bin/gunicorn --workers 3 --bind unix:/ho
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target" > /etc/systemd/system/gunicorn.service
|
WantedBy=multi-user.target" > /etc/systemd/system/gunicorn.service
|
||||||
|
echo -e "\tStarting gunicorn"
|
||||||
systemctl start gunicorn > $gunicornlogloc
|
systemctl start gunicorn > $gunicornlogloc
|
||||||
systemctl status gunicorn >> $gunicornlogloc
|
systemctl status gunicorn >> $gunicornlogloc
|
||||||
echo "Done."
|
echo -e "\tEnabling gunicorn at startup"
|
||||||
|
systemctl enable gunicorn 1>> $gunicornlogloc 2>> $gunicornlogloc
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Nginx
|
# Nginx
|
||||||
# configure nginx
|
# configure nginx
|
||||||
################################################################################
|
################################################################################
|
||||||
echo "Configuring Nginx..."
|
tput setaf 2
|
||||||
echo "
|
echo -e "Configuring Nginx"
|
||||||
|
tput setaf 0
|
||||||
|
echo -e "
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name $hostname;
|
server_name $hostname;
|
||||||
@@ -262,7 +358,13 @@ server {
|
|||||||
if [ ! $user = "nginx" ] ; then
|
if [ ! $user = "nginx" ] ; then
|
||||||
sed -i "s/user nginx/user $user nginx/" /etc/nginx/nginx.conf
|
sed -i "s/user nginx/user $user nginx/" /etc/nginx/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
echo -e "\tStarting nginx"
|
||||||
systemctl restart nginx >> $nginxlogloc
|
systemctl restart nginx >> $nginxlogloc
|
||||||
systemctl status nginx >> $nginxlogloc
|
systemctl status nginx >> $nginxlogloc
|
||||||
|
echo -e "\tEnabling nginx"
|
||||||
|
systemctl enable nginx 1>> $nginxlogloc 2>> $nginxlogloc
|
||||||
|
|
||||||
echo "Done. Logs can be found in $logdir"
|
tput setaf 2
|
||||||
|
echo -e "Done! Navigate to $hostname to access the site. Logs can be found in $logdir"
|
||||||
|
tput setaf 0
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user