设置启动 systemctl enable nginx
设置关闭 systemctl disable nginx
查看开机启动项 systemctl list-unit-files
查看是否开机启动 systemctl is-enabled nginx
启动脚本文件
/usr/lib/systemd/system/nginx.service
启动脚本文件软连接
/etc/systemd/system/multi-user.target.wants/nginx.service -> /usr/lib/systemd/system/nginx.service
nginx.service文件内容
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target