使用systemctl管理nginx
[Unit] Description=nginx After=network.target [Service] Type=forking ExecStartPre=/data/apps/nginx/sbin/nginx -t -c /data/apps/nginx/conf/nginx.conf ExecStart=/data/apps/nginx/sbin/nginx ExecReload=/data/apps/nginx/sbin/nginx -s reload ExecStop=/data/apps/nginx/sbin/nginx -s stop PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl daemon-reload
systemctl start nginx
systemctl stop nginx
systemctl status nginx