标签:nbsp sgi 服务 font 开机 etc net 查看 style
在 Ubuntu 上使用 Nginx+ uWSGI 部署Django项目,在实际生成环境中需要系统自动启动这两项服务,Ubuntu默认自启动Nginx,需要对uwsgi设置为系统自启动。
Ubuntu1804采用systemctl来管理开机启动的脚本,对于uwsgi服务要设置成系统服务来进行自启动。
文件 目录位置:/etc/systemd/system/
sudo vim /etc/systemd/system/uwsgi.service
Unit]
Description=uWSGI server
After=network.target
[Service]
User=username
Group=www-data
WorkingDirectory=/home/username/projectname #项目目录
#Environment=FLASKR_SETTINGS=/home/username/projectname/env.cfg #需要的环境变量配置文件
ExecStart=/home/username/.local/bin/uwsgi --ini uwsgi.ini #服务启动的代码,可用which命令查看uwsgi的具体位置
[Install]
WantedBy=multi-user.target #指明会跟随系统启动而启动该服务
sudo systemctl start uwsgi.service
sudo systemctl stop uwsgi.service
sudo systemctl restart uwsgi.service
sudo systemctl daemon-reload
sudo systemctl enable uwsgi.service
执行此命令后在/etc/systemd/system/multi-user.target.wants目录下生成uwsgi.sevice的链接文件,
Ubuntu1804系统的自启动项目均在此目录下。重启系统后,可看到uwsgi服务已启动。
1、建立service文件;
2、建立链接文件或复制文件到/etc/systemd/system/目录中;
3、通过systemctl enable uwsgi.service命令在/etc/systemd/system/multi-user.target.wants目录下生成uwsgi.sevice的链接文件。
标签:nbsp sgi 服务 font 开机 etc net 查看 style
原文地址:https://www.cnblogs.com/sdlyxyf/p/11366833.html