'Main process exited' 错误 Gunicorn systemd 文件
'Main process exited' error Gunicorn systemd file
我按照这个 article 来部署我的 Django 项目。我使用以下配置在 /etc/systemd/system/gunicorn.service
中创建了 gunicorn.service
文件:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=azizbek
Group=www-data
WorkingDirectory=/home/admin/respositories/ninersComingSoon
ExecStart=/root/.local/share/virtualenvs/ninersComingSoon-_UZsUc5R/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/admin/repositories/ninersComingSoon/niners.sock ninersComingSoon.wsgi:application
[Install]
WantedBy=multi-user.target
我的项目位置是/home/admin/respositories/ninersComingSoon
当我 运行
systemctl start gunicorn
systemctl enable gunicorn
它必须在项目目录中创建 niners.sock
文件,但它没有。
然后我输入这个命令来找出我做错了什么。
journalctl -u gunicorn
结果是
Dec 05 02:05:26 server.niners.uz systemd[1]: Started gunicorn daemon.
Dec 05 02:05:26 server.niners.uz systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Dec 05 02:05:26 server.niners.uz systemd[1]: gunicorn.service: Unit entered failed state.
Dec 05 02:05:26 server.niners.uz systemd[1]: gunicorn.service: Failed with result 'exit-code'.
那你能帮我解决这个问题吗?
问题出在 WorkingDirectory
。路径不正确。应该有 .../repositories/...
而不是 .../respositories/...
我按照这个 article 来部署我的 Django 项目。我使用以下配置在 /etc/systemd/system/gunicorn.service
中创建了 gunicorn.service
文件:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=azizbek
Group=www-data
WorkingDirectory=/home/admin/respositories/ninersComingSoon
ExecStart=/root/.local/share/virtualenvs/ninersComingSoon-_UZsUc5R/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/admin/repositories/ninersComingSoon/niners.sock ninersComingSoon.wsgi:application
[Install]
WantedBy=multi-user.target
我的项目位置是/home/admin/respositories/ninersComingSoon
当我 运行
systemctl start gunicorn
systemctl enable gunicorn
它必须在项目目录中创建 niners.sock
文件,但它没有。
然后我输入这个命令来找出我做错了什么。
journalctl -u gunicorn
结果是
Dec 05 02:05:26 server.niners.uz systemd[1]: Started gunicorn daemon.
Dec 05 02:05:26 server.niners.uz systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Dec 05 02:05:26 server.niners.uz systemd[1]: gunicorn.service: Unit entered failed state.
Dec 05 02:05:26 server.niners.uz systemd[1]: gunicorn.service: Failed with result 'exit-code'.
那你能帮我解决这个问题吗?
问题出在 WorkingDirectory
。路径不正确。应该有 .../repositories/...
而不是 .../respositories/...