Upstart
Save this file as /etc/init/nginx.conf
# nginx description "nginx http daemon" author "George Shammas <georgyo@gmail.com>" start on (filesystem and net-device-up IFACE=lo) stop on runlevel [!2345] env DAEMON=/usr/sbin/nginx env PID=/var/run/nginx.pid expect fork respawn pre-start script $DAEMON -t if [ $? -ne 0 ] then exit $? fi end script post-stop script start-stop-daemon --stop --pidfile $PID --name nginx --exec $DAEMON --signal TERM end script exec $DAEMON
“respawn” tells upstart to keep nginx master process alive and expect fork tracks ngnix after the fork. pre-start script helps say when the services fails
Then check the upstart job list:
initctl list | grep nginx
and start the job:
initctl start nginx










