Upstart setting for Nginx on ubuntu

安裝nginx

sudo apt-get install nginx

增加upstart的script

/etc/init/nginx.conf

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
respawn limit 10 5
#oom never
 
pre-start script
        $DAEMON -t
        if [ $? -ne 0 ]
                then exit $?
        fi
end script
 
exec $DAEMON

可以用upstart啟動了

sudo start nginx
sudo restart nginx
sudo stop nginx
comments powered by Disqus