内容简介:背景生产环境中采用nginx + uwsgi + django 来部署web服务,这里需要实现uwsgi的启动和停止,简单的处理方式可以直接在命令行中启动和kill掉uwsgi服务,但为了更安全、方便的管理uwsgi服务,配置uwsgi到systemd服务中,同时实现开启自启的功能;另,鉴于supervisor不支持python3,没采用supervisor来管理uwsgi服务;具体配置方法如下:
背景生产环境中采用nginx + uwsgi + django 来部署web服务,这里需要实现uwsgi的启动和停止,简单的处理方式可以直接在命令行中启动和kill掉uwsgi服务,但为了更安全、方便的管理uwsgi服务,配置uwsgi到systemd服务中,同时实现开启自启的功能;
另,鉴于supervisor不支持 python 3,没采用supervisor来管理uwsgi服务;
具体配置方法如下:
step1. 创建配置文件
/etc/systemd/system/server_uwsgi.service
step2. 填入以下内容
[Unit] Description=HTTP Interface Server After=syslog.target [Service] KillSignal=SIGQUIT ExecStart=/usr/bin/uwsgi --ini /path/uwsgi.ini Restart=always Type=notify NotifyAccess=all StandardError=syslog [Install] WantedBy=multi-user.target
step3. 将该服务加入到systemd中
systemctl enable /etc/systemd/system/server_uwsgi.service
然后就可以通过systemctl来控制服务的启停
systemctl stop server_uwsgi.service 关闭uwsgi服务
systemctl start server_uwsgi.service 开启uwsgi服务
systemctl restart server_uwsgi.service 重启uwsgi服务
注意事项:
如果uwsgi配置文件中配置了 daemonize=/path/uwsgi.log (uwsgi服务以守护进程运行) 会导致sytemctl启动时多次重启而导致启动失败 需改为 logto=/path/uwsgi.log
以上所述就是小编给大家介绍的《centos7 配置 uwsgi 系统服务(systemd)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 配置ELK系统(ElasticSearch+Logstash+Kibana)收集nginx系统日志(二): 配置Kibana
- EleWeb v1.4.0 旗舰版发布,新增系统配置管理模块,统一管理系统配置信息
- 告警系统主脚本,告警系统配置文件,告警系统监控项目
- Debian 系统如何配置 iptables
- [ webpack4 ] 配置属于自己的打包系统教程(一)—— 基础配置篇
- NFS网络文件存储系统搭建配置详解
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Java Servlet & JSP Cookbook
Bruce W. Perry / O'Reilly Media / 2003-12-1 / USD 49.99
With literally hundreds of examples and thousands of lines of code, the Java Servlet and JSP Cookbook yields tips and techniques that any Java web developer who uses JavaServer Pages or servlets will ......一起来看看 《Java Servlet & JSP Cookbook》 这本书的介绍吧!