In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to implement the restart script in Nginx", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "how to implement the restart script in Nginx".
Vi / etc/init.d/nginx
Then enter the following, and you will be able to use the
Service nginx start
Service nginx stop
Service nginx restart
Service nginx reload
The explanation here needs to be explained.
# chkconfig:
# description:
These two comments in the script are required, indicating that they are in a format supported by chkconfig. Otherwise, there will be a prompt similar to the following:
Service nginx does not support chkconfig
Remember to give permission to the script after you add it.
Chmod 755 nginx
Chmod + x nginx
[@ more@]
#! / bin/sh
#
# nginx-this script starts and stops the nginx daemin
#
# 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 is 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=$?
Echo
[$retval-eq 0] & & touch $lockfile
Return $retval
}
Stop () {
Echo-n $"Stopping $prog:"
Killproc $prog-QUIT
Retval=$?
Echo
[$retval-eq 0] & & rm-f $lockfile
Return $retval
}
Restart () {
Configtest | | return $?
Stop
Start
}
Reload () {
Configtest | | return $?
Echo-n $"Reloading $prog:"
Killproc $nginx-HUP
RETVAL=$?
Echo
}
Force_reload () {
Restart
}
Configtest () {
$nginx-t-c $NGINX_CONF_FILE
}
Rh_status () {
Status $prog
}
Rh_status_q () {
Rh_status > / dev/null 2 > & 1
}
Case "$1" in
Start)
Rh_status_q & & exit 0
, 1
Stop)
Rh_status_q | | exit 0
, 1
Restart | configtest)
, 1
Reload)
Rh_status_q | | exit 7
, 1
Force-reload)
Force_reload
Status)
Rh_status
Condrestart | try-restart)
Rh_status_q | | exit 0
*)
Echo $"Usage: $0 {start | stop | status | restart | condrestart | try-restart | reload | force-reload | configtest}"
Exit 2
Esac
The above is all the contents of the article "how to implement the restart script in Nginx". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.