1
我正在運行Debian網絡服務器,運行django應用程序的nginx和gunicorn。我已經得到了一切,並運行得很好,但重新啓動服務器後,我得到了502錯誤的網關錯誤。我已經將問題追溯到重新啓動之後,gunicorn處於非活動狀態。如果我啓動該服務,則問題將解決,直到我再次重新啓動服務器。gunicorn在啓動後不啓動
啓動服務:
systemctl start gunicorn.service
後重新啓動,這裏是我gunicorn服務狀態:
{username}@instance-3:~$ sudo systemctl status gunicorn
● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled)
Active: inactive (dead)
我/etc/systemd/system/gunicorn.service文件的內容:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User={username}
Group={username}
WorkingDirectory=/home/{username}/web/{projname}
ExecStart=/usr/local/bin/gunicorn {projname}.wsgi:application
Restart=on-failure
[Install]
WantedBy=multi.user.target
任何想法,找出爲什麼gunicorn服務沒有啓動後重新啓動?
編輯:
可能的問題是該gunicorn.conf在CHDIR不同的目錄和EXEC比工作目錄?
{username}@instance-3:~$ cat /etc/init/gunicorn.conf
cription "Gunicorn application server handling {projname}"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid {username}
setgid {username}
chdir /home/data-reporting/draco_reporting
exec {projname}/bin/gunicorn --workers 3 --bind unix:/home/{username}/data-reporting/{projname}/{projname}.sock {projname}.wsgi:application
編輯:我重新運行'固定錯字後systemctl使gunicorn.service'和現在的作品,因爲它應該。謝謝! – user1424311