XmahopAbuse
XmahopAbuse

Reputation: 31

Gunicorn failed with 203/EXEC

I'm trying to deploy my django project on CentOS 8 follow by this manual https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7

My project folder is

/home/xmahop/support_cabinet/support_cabinet/manage.py

virtualenv folder is /home/xmahop/support_cabinet/venv/

etc/systemd/system/gunicorn.service file is

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

[Service]
User=xmahop
Group=nginx
WorkingDirectory=/home/xmahop/support_cabinet/support_cabinet
ExecStart=/home/xmahop/support_cabinet/venv/bin/gunicorn --workers 3 --bind unix:/home/xmahop/support_cabinet/support_cabinet/support_cabinet/support_cabinet.sock support_cabinet.wsgi:application
[Install]
WantedBy=multi-user.target

nginx conf:

server {
listen 80;
server_name 192.168.136.131;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/xmahop/support_cabinet;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/home/xmahop/support_cabinet/support_cabinet.sock;
}
}

gunicorn status:

   Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2019-11-26 12:36:20 MSK; 33s ago
  Process: 9188 ExecStart=/home/xmahop/support_cabinet/venv/bin/gunicorn --workers 3 --bind unix:/home/xmahop/support_cabinet/support_cabinet/support_cabinet/support_cabinet.sock support_cabinet.wsgi:application (code=exited, status=>
 Main PID: 9188 (code=exited, status=203/EXEC)

Nov 26 12:36:20 localhost.localdomain systemd[1]: Started gunicorn daemon.
Nov 26 12:36:20 localhost.localdomain systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Nov 26 12:36:20 localhost.localdomain systemd[1]: gunicorn.service: Failed with result 'exit-code'.

Nginx logs are empty.

I'm tried chown xmahop:nginx to project folder and gunicorn conf file

Upvotes: 0

Views: 1331

Answers (1)

XmahopAbuse
XmahopAbuse

Reputation: 31

The reason was in SELinux, he was blocking access, so i just shutdown it, and it worked.

Upvotes: 1

Related Questions