开机启动nginx

https://www.cnblogs.com/jepson6669/p/9131217.html

需要重新启动systemctl

systemctl daemon-reload

nginx.service文件内容:存放路径 —> /lib/systemd/system/ —> 使用命令使其生效:systemctl enable nginx

systemctl enable nginx

 

[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

 

posted @ 2019-08-14 09:52  智走  阅读(160)  评论(0编辑  收藏  举报