nginx 自启动
来源:互联网 发布:linux is a directory 编辑:程序博客网 时间:2024/06/06 05:19
把以下脚本保存为nginx文件放入/etc/init.d/nginx
然后可以通过
/etc/init.d/nginx start 命令启动nginx
/etc/init.d/nginx stop 命令停止nginx
/etc/init.d/nginx restart 命令重启nginx
开机自动启动nginx,
如果需要开机启动服务,保存好 /etc/init.d/nginx文件后,
执行以下命令:
chkconfig --add nginx
chkconfig --level nginx 2345 on
---------------------分割线下是脚本内容,红色字体需要你修改-------------------------------------------
#! /bin/sh
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
CONFIGFILE=/usr/local/nginx/conf/$NAME.conf
PIDFILE=/usr/local/nginx/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
set -e
[ -x "$DAEMON" ] || exit 0
do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
kill -INT `cat $PIDFILE` || echo -n "nginx not running"
}
do_reload() {
kill -HUP `cat $PIDFILE` || echo -n "nginx can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0
阅读全文
0 0
- 开机自启动nginx
- nginx自启动脚本
- nginx没有自启动
- nginx自启动脚本
- 开机自启动nginx
- nginx开机自启动
- nginx 自启动
- Nginx windows开机自启动
- nginx开机自启动设置
- linux 开机自启动nginx
- Red Hat NGINX 自启动
- nginx 自启动代码-官网
- ubuntu下设置Nginx自启动
- debian 增加 nginx 自启动脚本
- ubuntu 下 nginx 自启动设置
- debian 增加 nginx 自启动脚本
- Linux下nginx的自启动脚本
- Ubuntu中Nginx 开机自启动
- c++访问控制与继承
- 微信公众平台开发入门教程
- HDU-1233 还是畅通工程(prim)
- 幂运算
- 用C++可变参数模板实现类似C语言的printf
- nginx 自启动
- 利用深度优先搜索算法和广度优先搜索算法解迷宫问题
- Rhyme/ java TCP网络编程 聊天室(群聊与私聊)TCP、多线程、IO流编程完整代码实现
- SpringMVC详解
- strstr函数的用法
- 前端基础 css笔记
- Java多线程的6种状态
- Functional Interface- java8引入特性
- 利用栈对数据进行逆置操作