[root@admin nginx-1.18.0]# vim /lib/systemd/system/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 -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@admin nginx-1.18.0]# systemctl enable nginx.service
[root@admin sbin]# systemctl start nginx
[root@admin nginx-1.18.0]# systemctl status nginx