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
可重启检查状态是否生效

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2021-10-27
  • 2021-05-19
  • 2021-03-27
  • 2022-12-23
相关资源
相似解决方案