vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
#二进制文件启动命令
ExecReload=/usr/local/nginx/sbin/nginx -s reload
#二进制文件重启命令
ExecStop=/usr/local/nginx/sbin/nginx -s stop
#二进制文件停止命令
[Install]
WantedBy=multi-user.target
systemctl daemon-reload # 加入进入到系统进程
systemctl start nginx # 启动
systemctl stop nginx #停止
systenctl restart # 重启