uwsgi开机自启动服务
配置
vim /etc/systemd/system/uwsgi.service
[Unit]
Description=uWSGI server
After=syslog.target
[Service]
#用户名
User=root
#项目目录
WorkingDirectory=/app/aipc/dev/fe-flask
#需要的环境变量配置文件
#Environment=/home/username/projectname/env.cfg
#服务启动的代码,可用which命令查看uwsgi的具体位置User=username
ExecStart=/usr/local/bin/uwsgi --ini /app/aipc/dev/fe-flask/wsgi.ini
Restart=always
#用户组
Group=root
[Install]
#指明会跟随系统启动而启动该服务
WantedBy=multi-user.target
Alias=uwsgi.service
启动,开机自启动
sudo systemctl restart uwsgi.service
sudo systemctl status uwsgi.service
sudo systemctl daemon-reload
sudo systemctl enable uwsgi.service
执行此命令后在/etc/systemd/system/multi-user.target.wants目录下生成uwsgi.sevice的链接文件,
本文来自博客园,作者:王竹笙,转载请注明原文链接:https://www.cnblogs.com/edeny/p/18517786