gpt4 book ai didi

django - Gunicorn 因 203/EXEC 失败

转载 作者:行者123 更新时间:2023-12-04 19:41:36 24 4
gpt4 key购买 nike

我正在尝试在 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;
}
}

unicorn 状态:
   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 文件

最佳答案

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

关于django - Gunicorn 因 203/EXEC 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59048728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com