fix bug where user could not be nginx

This commit is contained in:
ducoterra
2018-09-13 20:49:09 -04:00
parent cee9975905
commit 5dbd63513e

View File

@@ -138,7 +138,7 @@ echo "Done."
echo "Starting Django project..."
if [ ! -d "/home/$user" ] ; then
mkdir /home/$user
chown $user:$user /home/$user
chown -R $user:$user /home/$user
fi
mkdir /home/$user/$projectname
if [ $? -ne 0 ] ; then
@@ -199,7 +199,7 @@ deactivate
if [ $? -ne 0 ] ; then
echo "Failed to deactivate virtual environment, (this may not be an issue). $djamsg"
fi
chown -R centos:centos $projectname
chown -R $user:$user $projectname
if [ $? -ne 0 ] ; then
echo "Failed to change permissions of $projectname. $djamsg"
exit 1
@@ -252,8 +252,11 @@ server {
proxy_pass http://unix:/home/$user/$projectname/$projectname.sock;
}
}" > /etc/nginx/conf.d/mysite.conf
# set the nginx user
if [ ! $user = "nginx" ] ; then
sed -i "s/user nginx/user $user nginx/" /etc/nginx/nginx.conf
fi
systemctl restart nginx
systemctl status nginxsetup
systemctl status nginx
echo "Done. Logs can be found in /root/logs/"