# 项目地址
/home/crime/sites/demo.eosones.com/Myblog
# 虚拟环境
/home/crime/sites/demo.eosones.com/Myblog_env
配置代码
# vim /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/home/crime/sites/demo.eosones.com/Myblog
ExecStart=/home/crime/sites/demo.eosones.com/Myblog_env/bin/gunicorn --workers 3 --bind 127.0.0.1:8080 Myblog.wsgi:application
[Install]
WantedBy=multi-user.target
报错信息
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Started gunicorn daemon.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service: main process exited, code=exited, status=216/GROUP
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Unit gunicorn.service entered failed state.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service failed.
小白刚接触Linux,求大佬帮忙到底是哪里出错了,直接在虚拟环境中gunicorn --workers 3 --bind 127.0.0.1:8080 Myblog.wsgi:application
可以成功启动,添加到systemd就失败。
journalctl -u gunicorn.service
看一下错误日志
Jun 20 17:48:44 VM_0_5_centos systemd[1]: Started gunicorn daemon.
Jun 20 17:48:44 VM_0_5_centos systemd[1]: gunicorn.service: main process exited, code=exited, status=216/GROUP
Jun 20 17:48:44 VM_0_5_centos systemd[1]: Unit gunicorn.service entered failed state.
Jun 20 17:48:44 VM_0_5_centos systemd[1]: gunicorn.service failed.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Started gunicorn daemon.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service: main process exited, code=exited, status=216/GROUP
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Unit gunicorn.service entered failed state.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service failed.
错误日志中都是这个报错信息
@CRIME: 可能是 Group=www-data
引起的,试试改为 Group=root
@dudu: 感谢大佬,可以了