centos7.6 配置nginx自启动

2020-06-22  本文已影响0人  Daisy小朋友

配置systemctl自启动

# cd /lib/systemd/system/
# vim 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 quit
PrivateTmp=true 
   
[Install] 
WantedBy=multi-user.target

QUIT:从容关闭
nginx -s reload : 热重启
退出并保存文件,执行systemctl enable nginx.service使nginx开机启动
启动方法:
systemctl start nginx.service 启动nginx
systemctl stop nginx.service 结束nginx
systemctl restart nginx.service 重启nginx

上一篇下一篇

猜你喜欢

热点阅读