gunicorn.service:步骤 EXEC 生成 {PATH}/env/bin/gunicorn 失败:权限被拒绝

gunicorn.service:步骤 EXEC 生成 {PATH}/env/bin/gunicorn 失败:权限被拒绝

创建 gunicorn.service 文件后,我运行

sudo systemctl enable gunicorn.service
sudo systemctl start gunicorn.service

但是,我收到以下错误。这是运行后返回的日志

sudo systemctl status gunicorn.service

错误日志

ubuntu@ip-000-00-00-00:~/webapp/appname$ sudo systemctl status gunicorn
● gunicorn.service - gunicorn service
   Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-07-18 21:28:42 UTC; 19min ago
  Process: 11634 ExecStart=/home/ubuntu/webapp/appname/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/ubuntu/webapp/appname/appname.sock appname.wsgi:application
Main PID: 11634 (code=exited, status=203/EXEC)

Jul 18 21:28:42 ip-000-00-00-00 systemd[1]: Started gunicorn service.
Jul 18 21:28:42 ip-000-00-00-00 systemd[11634]: gunicorn.service: Failed to execute command: Permission denied
Jul 18 21:28:42 ip-000-00-00-00 systemd[11634]: gunicorn.service: Failed at step EXEC spawning /home/ubuntu/webapp/appname/env/bin/gunicorn: Permission denied
Jul 18 21:28:42 ip-000-00-00-00 systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jul 18 21:28:42 ip-000-00-00-00 systemd[1]: gunicorn.service: Failed with result 'exit-code'.

/home/ubuntu/webapp/appname/env/bin/gunicorn这是路径中 gunicorn 文件的权限

ubuntu@ip-000-00-00-00:~/webapp/appname/env/bin$ ls -l gunicorn
-rwxrwx--x 1 ubuntu ubuntu 257 Jul 13 07:20 gunicorn

不确定为什么权限被拒绝。有什么可以帮忙的吗?

答案1

我遇到了类似的问题。我有一个 Web 应用程序(前端 + 后端);有一天,前端无法正确访问后端。gunicorn 显示的日志几乎和你一样。我不得不在我的网站上放一个 https 证书(因为它已经过期)才能让一切恢复正常

相关内容