Home > Net >  what should I put as my 'Group' in gunicorn service file
what should I put as my 'Group' in gunicorn service file

Time:09-28

I'm runnng an EC2 on ubuntu 18.04 , but I'm not sure if I've set the 'Group' correctly in the gunicorn service file, currently I have 'www-data'. When I list the groups by entering command 'groups' it shows the list of users, but I can't see 'www-data', am I doing this correctly?:

groups:

ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd

current gunicorn service file:

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/djangoapp1
ExecStart=/home/ubuntu/env/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
djangoapp1.wsgi:application

[Install]
WantedBy=multi-user.target 

CodePudding user response:

my gunicorn service file was correct but I didn't have www-data in my groups, now I'm able to write to my file directory, I added 'www-data' group by:

sudo adduser www-data <user>

you can check it was added by entering:

groups <user>

then I also had to change my file user permissions to 'ubuntu' user, this allows me to write to the directory, I did this by entering:

sudo chown <user>:<user> -R <path to directory>
  • Related