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 証明書 (期限切れのため) を配置する必要がありました。

関連情報