Use this for Gunicorn.service code:
Notice the separation of the access log. Rather than override the previous log, we create a totally separate one. This will produce a different result and reflect the production website and not the development one.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[Unit] Description=Gunicorn server for superlists.mywebsite.com [Service] Restart=on-failure User=ubuntu WorkingDirectory=/home/ubuntu/sites/superlists.mywebsite.com EnvironmentFile=/home/ubuntu/sites/superlists.mywebsite.com/.env ExecStart=/home/ubuntu/sites/superlists.mywebsite.com/virtualenv/bin/gunicorn --bind unix:/tmp/superlists.mywebsite.com.socket --access-logfile "/var/log/gunicorn_access_prod.log" --error-logfile "/var/log/gunicorn_error_prod.log" superlists.wsgi:application --log-level ERROR [Install] WantedBy=multi-user.target |
Reboot all servers after changes (nginx, gunicorn) when in doubt.