fix bug where user could not be nginx
This commit is contained in:
11
install.sh
11
install.sh
@@ -138,7 +138,7 @@ echo "Done."
|
|||||||
echo "Starting Django project..."
|
echo "Starting Django project..."
|
||||||
if [ ! -d "/home/$user" ] ; then
|
if [ ! -d "/home/$user" ] ; then
|
||||||
mkdir /home/$user
|
mkdir /home/$user
|
||||||
chown $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
|
||||||
@@ -199,7 +199,7 @@ deactivate
|
|||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to deactivate virtual environment, (this may not be an issue). $djamsg"
|
echo "Failed to deactivate virtual environment, (this may not be an issue). $djamsg"
|
||||||
fi
|
fi
|
||||||
chown -R centos:centos $projectname
|
chown -R $user:$user $projectname
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to change permissions of $projectname. $djamsg"
|
echo "Failed to change permissions of $projectname. $djamsg"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -252,8 +252,11 @@ server {
|
|||||||
proxy_pass http://unix:/home/$user/$projectname/$projectname.sock;
|
proxy_pass http://unix:/home/$user/$projectname/$projectname.sock;
|
||||||
}
|
}
|
||||||
}" > /etc/nginx/conf.d/mysite.conf
|
}" > /etc/nginx/conf.d/mysite.conf
|
||||||
sed -i "s/user nginx/user $user nginx/" /etc/nginx/nginx.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 restart nginx
|
||||||
systemctl status nginxsetup
|
systemctl status nginx
|
||||||
|
|
||||||
echo "Done. Logs can be found in /root/logs/"
|
echo "Done. Logs can be found in /root/logs/"
|
||||||
|
|||||||
Reference in New Issue
Block a user