建立 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
我有類似的問題。我有一個網頁應用程式(前端+後端);有一天前端無法正確存取後端。 Gunicorn 顯示的日誌幾乎與您相同。我必須在我的網站上放置一個 https 憑證(因為它已經過期)才能讓一切恢復正常