#!/bin/bash
# Tengine Startup script# processname: nginx
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/openresty/nginx/sbin/nginx
nginx_config=/usr/local/openresty/nginx/conf/nginx.conf
nginx_pid=/usr/local/openresty/nginx/logs/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 "tengine 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 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
分享到:
相关推荐
nginx自启动
nginx开机启动脚本
ubuntu开机自启动nginx服务
Nginx启动或重启失败,一般是因为配置文件出错了,我们可以使用nginx -t方法查看配置文件出错的地方。 也可以通过查看Nginx日志文件定位到Nginx重启失败的原因,Nginx日志文件的路径一般在:/var/log/nginx目录下 ...
# nginx Startup script for nginx # # chkconfig: - 85 15 # processname: nginx # config: /etc/nginx/nginx.conf # config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # description: nginx is a ...
Linux配置Nginx服务开机自启动(centos7.*配置方式不同),脚本中‘nginx=‘和‘NGINX_CONF_FILE=’后面的*****替换成自己的nginx安装路径。把脚本复制到init.d/目录下,添加chkconfig --add nginx即可。注意脚本的...
用于配置nginx自启动,解压导nginx的根目录
Nginx开启自启文件,在/etc/init.d 目录下创建一个新的nginx文件后将内容复制进去。(不建议将文件直接复制到/etc/init.d 目录下,以免引起windows和linux环境下格式转换的不必要麻烦)
windows启动nginx脚本
启动nginx命令说明:需要注意,由于nginx默认端口也是80端口,如果此时你的机器上开启了Apache或者IIS服务,切忌在启动nginx之前务必关闭IIS或Apache服务,否则nginx启动命令不会成功。 nginx命令:停止nginx ...
nginx开机启动
nginx配置修改后运行此脚本启动nginx。 其脚本的作用往往是简化了启动的便利
window下Nginx启动bat脚本若中文乱码,则新建脚本文件时改为ANSI编码格式即可 稳定版:nginx-1.15.12:https://download.csdn.net/download/luxiukang/11171445 最新版:nginx-1.16.0:...
Nginx开启自启文件,根据具体情况,修改安装路径,然后将文件放入/etc/rc.d/init.d下即可
nginx与插件 , 启动不了nginx ,可以用这个插件进行启动 。
查看nginx容器一直都是退出状态
nginx免安装版,放到项目下面直接可用;里面包含nginx服务启动/停止/重启的bat程序;配置文件也配好已测试过,其中html文件夹为前端包。
讲述nginx的启动过程,用于整体了解nginx的程序框架
Nginx启动程序
解决Nginx启动脚本在redhat上无法启动的问题