cd /lib/systemd/system/
vim nginx.service
[Unit]
Description=nginx service
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 quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl enable nginx
systemctl daemon-reload
可重启检查状态是否生效
centos7-nginx开机自启
猜你喜欢
转载自www.cnblogs.com/kylingx/p/12586159.html
今日推荐
周排行