I'm setting up an ec2 server to run a django project with ngnix & gunicorn. The server is running Amazon Linux. When I run the start gunicorn command from the command line, it starts up the server, but when I try to run it from supervisor I get the following error:
supervisor: couldn't chdir to /home/ec2-user/virtualenvs/wakeup-site/django-site: EACCES
supervisor: child process was not spawned
This happens when I run supervisor as sudo or as my own user. Permission for the dir: /home/ec2-user/virtualenvs/wakeup-site/django-site
drwxrwxrwx 15 ec2-user ec2-user 4096 Mar 6 08:21 django-site
Relevant Supervisor.conf lines:
[program:wakeup]
command=./start_gunicorn.bash
directory="/home/ec2-user/virtualenvs/wakeup-site/django-site"
user=ec2-user
autostart=true
autorestart=true
stdout_logfile=/home/ec2-user/virtualenvs/wakeup-site/django-site/logs/supervisorconf.log
stderr_logfile=/home/ec2-user/virtualenvs/wakeup-site/django-site/logs/gunicorn_stderr.log
start_gunicorn.bash:
#!/bin/bash
# Starts the Gunicorn server
set -e
# Activate the virtualenv for this project
%(ACTIVATE)s
# Start gunicorn going
exec gunicorn wakeup.wsgi:application -c gunicorn.conf.py
I have tried removing the directory line from supervisor, and just making the command a full path, tried running as sudo and removing the ect2-user line with chown the whole dir as root. When I run
exec gunicorn wakeup.wsgi:application -c gunicorn.conf.py
from the command line it works and I can browse to the site.
Can someone please help??