【问题标题】:Gunicorn failed with 203/EXECGunicorn 因 203/EXEC 失败
【发布时间】:2020-03-21 17:48:41
【问题描述】:

我正在尝试在 CentOS 8 上部署我的 django 项目,请遵循本手册 https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7

我的项目文件夹是

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

virtualenv 文件夹是 /home/xmahop/support_cabinet/venv/

etc/systemd/system/gunicorn.service 文件是

[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 配置:

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;
}
}

独角兽状态:

   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 日志为空。

我尝试 chown xmahop:nginx 到项目文件夹和 gunicorn conf 文件

【问题讨论】:

    标签: django linux nginx centos gunicorn


    【解决方案1】:

    原因是在 SELinux 中,他阻止了访问,所以我只是将其关闭,它起作用了。

    【讨论】:

      猜你喜欢
      • 2020-12-18
      • 2022-08-17
      • 2018-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-26
      相关资源
      最近更新 更多