码迷,mamicode.com
首页 > 其他好文 > 详细

使nginx归于systemd管理

时间:2019-08-23 19:33:57      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:div   root   lib   serve   star   exe   emc   unit   use   

[root@centos7 ~]# vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The Nginx HTTP Server daemon #必须加守护神不然会报错
#描述信息
After=network.target remote-fs.target nss-lookup.target
#指定启动nginx之前需要其他的其他服务,如network.target等
[Service]
Type=forking
#Type为服务的类型,仅启动一个主进程的服务为simple,需要启动若干子进程的服务为forking
ExecStart=/usr/local/nginx/sbin/nginx
#设置执行systemctl start nginx后需要启动的具体命令.
ExecReload=/usr/local/nginx/sbin/nginx -s reload
#设置执行systemctl reload nginx后需要执行的具体命令.
ExecStop=/bin/kill -s QUIT ${MAINPID}
#设置执行systemctl stop nginx后需要执行的具体命令.
[Install]
WantedBy=multi-user.target
[root@centos7 ~]#systemctl daemon-reload #多加载几遍就可以了
#然后就nginx就可以跟大众服务一样啦!
[root@centos7 ~]#systemctl start nginx
[root@centos7 ~]#systemctl start renginx
[root@centos7 ~]#systemctl reload nginx
[root@centos7 ~]#systemctl stop nginx

 

使nginx归于systemd管理

标签:div   root   lib   serve   star   exe   emc   unit   use   

原文地址:https://www.cnblogs.com/tomcache/p/11401973.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!