How to add Nginx to system services

  
 

Nginx will not be registered as a system service by default after installation, so you need to manually add the system service script to provide a Nginx service script that I have written and tested, copy it directly, and put it in /etc/Init.d/is renamed to nginx and change the permissions chmod +x /etc/init.d/nginx.

Start nginx
service nginx start

or
/etc/init .d/nginx start

Other commands can be viewed directly from the script, very simple.
#! /bin/sh#Script used to register Nginx as a system service #Author CplusHua#http://www.219.me#chkconfig: - 85 15set -ePATH=/usr/local/sbin:/Usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binDESC="Nginx Daemon"NAME=nginxDAEMON=/usr/local/nginx/sbin/$NAMESCRIPTNAME=/etc/init.d/Exit the test -x $DAEMON

Copyright © Windows knowledge All Rights Reserved