1、关闭Nginx 利用ps -aux | grep Nginx 查看Nginx是否启动 如果启动了就kill杀死 2、创建/etc/init.d/Nginx文件
Nginx-1.2.3# vim /etc/init.d/Nginx
3、添加权限并启动
Nginx-1.2.3# chmod +x /etc/init.d/Nginx
root@dnnp:~/software/Nginx-1.2.3# /etc/init.d/Nginx start
Starting Nginx: Nginx.
root@dnnp:~/software/Nginx-1.2.3# ps -aux | grep Nginx
Warning: bad ps Syntax,perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 25078 0.0 0.0 4596 700 ? Ss 14:20 0:00 Nginx: master process /usr/local/Nginx/sbin/Nginx
nobody 25079 0.0 0.1 4820 1056 ? S 14:20 0:00 Nginx: worker process
root 25081 0.0 0.0 3304 768 pts/0 S+ 14:20 0:00 grep Nginx
root@dnnp:~/software/Nginx-1.2.3#
502_10@&2
exit 1
;;
esac
exit 0