Gunicorn和Supervisor错误文件没有可执行权限

2 投票
2 回答
7451 浏览
提问于 2025-04-18 01:09

我正在尝试运行这个命令:

sudo supervisorctl start gunicorn_process

在Ubuntu系统上,但我遇到了这个错误:

这里输入图片描述

如你所见,这个文件确实有可执行的权限。

gunicorn_process 文件:

[program:gunicorn_process]
command=/srv/domain wsgi:application
directory=/srv/domain
user=root

2 个回答

3

让这个文件可以执行:sudo chmod u+x gunicorn_process

5

这个 command 指令需要一个可执行的命令,Supervisor 会去运行它。

你说你想要运行

gunicorn wsgi:application

那么你可以这样设置你的配置:

[program:gunicorn_process]
command=gunicorn wsgi:application
directory=/srv/domain
user=root

有两点需要注意:

  1. 你不应该以 root 用户身份运行你的 wsgi 应用。这会有潜在的安全问题。你应该创建一个没有额外权限的用户,专门用来运行你的网页应用和服务器。

  2. 你可能需要把 command 指令改成包含 gunicorn 可执行文件的完整路径。可以用 which gunicorn 来查找它的位置。例如: command=/usr/bin/gunicorn wsgi:application

撰写回答