CentOS system sets nginx to start automatically

Nginx is a powerful high-performance web and reverse proxy server. The following describes how to set up automatic startup after installation under linux. First, create the nginx file in the /etc/init.d/ directory of the Linux system, and use the following command: vi /etc/init.d/nginx Add the following command to the script: ***************************************************** ***************************************************** ******************************* #!/bin/bash # nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig: -85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it’s not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_cOnfig=/usr/local/nginx/conf/nginx.conf nginx_pid=/var/run/nginx.pid RETVAL=0 prog=”nginx” # Source function library. ./etc/rc.d/init.d/functions # Source networking configuration. ./etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = “no” ] && exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo “nginx already running….” exit 1 fi echo -n $”Starting $prog: “ daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $”Stopping $prog: “ killproc $nginxd RETVAL=$? echo [ $RETVAL = 0…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索