Hi I want to have a NixOS - Nginx - Gunicorn - Python Flask setup, but got stucked.
I managed to run gunicorn as a systemd service, but got the following feedback:
× versike_project.service - Gunicorn instance to serve versike_project
Loaded: loaded (/etc/systemd/system/versike_project.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Tue 2024-10-15 22:49:18 CEST; 507ms ago
Duration: 22ms
Process: 7442 ExecStart=/home/picibucor/versike_project/versike_projectenv/bin/gunicorn --workers 3 --bind unix:/home/picibucor/versike_project/versike_project.sock -m 770 wsgi:app (code=exited, status=203/EXEC)
Main PID: 7442 (code=exited, status=203/EXEC)
IP: 0B in, 0B out
CPU: 4ms
Okt 15 22:49:18 nixos systemd[1]: Started Gunicorn instance to serve versike_project.
Okt 15 22:49:18 nixos (gunicorn)[7442]: versike_project.service: Failed to execute /home/picibucor/versike_project/versike_projectenv/bin/gunicorn: Permission denied
Okt 15 22:49:18 nixos systemd[1]: versike_project.service: Main process exited, code=exited, status=203/EXEC
Okt 15 22:49:18 nixos systemd[1]: versike_project.service: Failed with result 'exit-code'.
warning: error(s) occurred while switching to the new configuration
In configuration.nix the systemd service user is defined to be the user nginx
, however the flask-project (versike_project) is located at /home/picibucor/versike_project
. It is no wonder that the user “nginx” does not have permission over /home/picibucor/versike_project
.
I tried the command sudo chmod -R 755 /home/picibur/versike_project
as well, but did not helped either.
Where should I create my flask-project to avoid the permission denied issue?
Is there anything else I could try to resolve the issue?
Thanks in advance.