Nginx之编译安装的nginx加入systemctl

  编译安装的nginx需要添加rc.local

  编译安装后设置

 /usr/lib/systemd/system/nginx.service

  

[Unit]
Description=nginx
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target

  配置生效

systemctl daemon-reload

  可以使用systemctl启动nginx了

systemctl start nginx
systemctl enable nginx

  

posted @ 2019-04-08 10:43  minseo  阅读(473)  评论(0编辑  收藏  举报