#!/bin/bash
# v.0.0.1
# create by jackbillow at 2007.10.15
# nginx - This shell script takes care of start ing and stopping nginx.
#
# chkconfig: - 60 50
# description: nginx [engine x] is light http web/proxy server
# that answers incoming ftp service requests.
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
nginx_path="/usr/local/nginx"
nginx_pid="/usr/local/nginx/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
[ -x $nginx_path/sbin/nginx ] || exit 0
RETVAL=0
prog="nginx"
start() {
# Start daemons.
if [ -e $nginx_pid -a ! -z $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
if [ -e /usr/local/nginx/conf/nginx.conf ];then
echo -n $"Starting $prog: "
$nginx_path/sbin/nginx -c /usr/local/nginx/conf/nginx.conf &
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
else
RETVAL=1
fi
return $RETVAL
}
# Stop daemons.
stop() {
echo -n $"Stopping $prog: "
killproc -d 10 $nigx_path/sbin/nginx
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f $nginx_pid /var/lock/subsys/$prog
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reconfigure)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|reconfigure|status}"
exit 1
esac
exit $RETVAL
分享到:
相关推荐
nginx自动化安装shell脚本
windows启动nginx脚本
nginx 自动化安装脚本,下载直接运行安装就可以,还集成了限制国家ip模块
linux系统nginx一键自动离线安装包,含安装脚本。内含zlib、pcre、openssl、nginx等安装包
nginx开机启动脚本
nginx配置修改后运行此脚本启动nginx。 其脚本的作用往往是简化了启动的便利
说明: 1、一键生成Nginx https证书,证书格式为pem 2、只需修改ip地址为当前环境的ip地址即可使用
Nginx启动或重启失败,一般是因为配置文件出错了,我们可以使用nginx -t方法查看配置文件出错的地方。 也可以通过查看Nginx日志文件定位到Nginx重启失败的原因,Nginx日志文件的路径一般在:/var/log/nginx目录下 ...
Nginx开启自启文件,在/etc/init.d 目录下创建一个新的nginx文件后将内容复制进去。(不建议将文件直接复制到/etc/init.d 目录下,以免引起windows和linux环境下格式转换的不必要麻烦)
windows+nginx+php带启动/停止脚本 ,需要自己修改压缩包里的start.bat,stop.bat 和nginx.conf文件内的路径设置成你自己的就OK了。
# 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 ...
解决Nginx启动脚本在redhat上无法启动的问题
Linux自动化脚本安装Nginx使用说明,里面带了所需要的文件与文档说明
CentOS 8 开机启动Nginx脚本
http://blog.csdn.net/yaoxun1990/article/details/49590831 对应部署教程地址
nginx启动脚本
nginx启动脚本,下载后可以直接上传使用
window下Nginx启动bat脚本若中文乱码,则新建脚本文件时改为ANSI编码格式即可 稳定版:nginx-1.15.12:https://download.csdn.net/download/luxiukang/11171445 最新版:nginx-1.16.0:...
利用crontab定时机制触发shell脚本,自动切割nginx的日志文件,并实现自动清理,可直接在服务器上上传使用
原文链接:https://blog.csdn.net/m0_37814112/article/details/119391879?spm=1001.2014.3001.5501 说明:一键生产nginx https自签证书脚本,真实有效!