admin avatar

register nginx systemctl service

🕓 by admin





Register nginx systemctl service

Easy to manage and use ,,,

vi /lib/systemd/system/nginx.service

Add the following code

1
2
3
4
5
6
7
8
9
10
11
12
13
[Unit]
Description = nginx
After = network.target

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

[Install]
WantedBy = multi-user.target

Common commands

1
2
3
4
5
systemctl  start nginx.service    //start nginx service
systemctl  stop nginx.service    //close nginx service
systemctl  restart nginx.service   // restart nginx service
systemctl  reload snginx.service   //reload nginx configuration file
systemctl  status nginx.service     // View nginx service status





💘 相关文章





写一条评论

Based on Golang + fastHTTP + sdb | go1.18.1 Processed in 2ms