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的链接文件,

posted @ 2024-10-31 14:55  王竹笙  阅读(2)  评论(0编辑  收藏  举报