2.
[Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/www/lanmps/init.d/nginx start ExecReload=/www/lanmps/init.d/nginx restart ExecStop=/www/lanmps/init.d/nginx stop PrivateTmp=true [Install] WantedBy=multi-user.target
3. systemctl enable nginx.service
systemd has system and user distinction; system (/usr/lib/systemd/system/) and user (/usr/lib/systemd/user/) are placed in the system directory, and there is no login during startup The program that can be run under the command; otherwise, put it in the user directory
[img]
http://dl2.iteye.com/upload/attachment/0115/3120/32422b67-0fc9-36f3-b371-2853ea855a20.png
[/img]
4.
Start the nginx service
systemctl start nginx.service
to set the self-starting
systemctl enable nginx.service
to stop the booting and self-starting
systemctl disable nginx.service to
view the current status of the service
systemctl status nginx.service
to restart the service
systemctl restart nginx.service to
view all started service
systemctl list-units --type=service