Nginx Start, restart, stop script
The first stepRun the command first to close Nginxsudo kill ' Cat/usr/local/nginx/logs/nginx.pid '
Step TwoVi/etc/init.d/nginx Enter the following: #!/bin/bash## nginx-this script starts and stops the Nginx daemon## chkconfig:-85 15 # Description:nginx is an HTTP (s) server, HTTP (s) reverse \# proxy and imap/pop3 proxy server# processname:nginx# config :/usr/local/nginx/conf/nginx.conf# pidfile:/usr/local/nginx/logs/nginx.pid # Source function Library. /etc/rc.d/init.d/functions # Source Networking configuration: /etc/sysconfig/network # Check that networking are up. ["$NETWORKING" = "no"] && exit 0 nginx= "/usr/local/nginx/sbin/nginx" prog=$ (basename $nginx) nginx_conf_ File= "/usr/local/nginx/conf/nginx.conf" Lockfile=/var/lock/subsys/nginx start () { [x $nginx] | | Exit 5 [-F $NGINX _conf_file] | | Exit 6 Echo-n $ "Starting $prog:" daemon $nginx-C $NGINX _conf_file RETVAL=$?&NBSP ; echo [$retval-eq 0] && touch $lockfile return $retval} stop () {&nbsP Echo-n $ "stopping $prog:" Killproc $prog-quit retval=$? echo [$retval-eq 0] && rm-f $lockfile return $retval} restart () { Configtest | | ret Urn $? stop start} reload () { Configtest | | Return $? ECHO-N $ "R Eloading $prog: " Killproc $nginx-hup retval=$? echo} force_reload () { Restart} configtest () { $nginx-T-C $NGINX _conf_file} rh_status () { status $p Rog} rh_status_q () { rh_status >/dev/null 2>&1} case "$" in start) Rh_status_q && exit 0 start ;; stop) RH_STATUS_Q | | Exit 0 stop ; restart|configtest restart ;; Reload)   Rh_status_q | | Exit 7 reload ; force-reload force_reload ;; status rh_status ;; Condrestart|try-restart) RH_STATUS_Q | | Exit 0 ;; *) echo $ "Usage: $ start|stop|status|restart|condrestart|try-restart|reload|force-reload |configtest} " exit 2 ;; esac Save Exit
Step threechmod +x/etc/init.d/nginx
Fourth Step/sbin/chkconfig nginx on Check sudo/sbin/chkconfig--list nginxnginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off
done! After that, you can use the following command the service nginx startservice nginx stopservice nginx restartservice nginx ReloadService Nginx Status/etc/init.d/nginx Start/etc/init.d/nginx Stop/etc/init.d/nginx Restart/etc/init.d/nginx Reload/etc/init.d/nginx StatusReprint Address: http://blog.sina.com.cn/s/blog_6dc1452201013q7q.html
Linux configuration Nginx boot, stop