国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

Nginx和PHP-FPM的啟動(dòng)、重啟、停止腳本分享

2019-10-26 18:43:45
字體:
供稿:網(wǎng)友

服務(wù)器上的Nginx和PHP都是源碼編譯安裝的,不像ubuntu一樣有自帶service啟動(dòng)腳本,所以不支持類似以前的nginx (start|restart|stop|reload)了。自己動(dòng)手豐衣足食。以下腳本應(yīng)該在RHEL, Fedora, CentOS下都適用。

一、Nginx啟動(dòng)腳本/etc/init.d/nginx

代碼如下:
#!/bin/bash
#
# Startup script for Nginx - this script starts and stops the nginx daemon
#
# 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"
 
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
 
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
    sleep 1
    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)

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 岐山县| 徐闻县| 潍坊市| 永丰县| 横山县| 长寿区| 昆山市| 郸城县| 嘉义县| 永丰县| 山阴县| 韶山市| 星子县| 阿巴嘎旗| 桂阳县| 项城市| 宿州市| 隆安县| 乌鲁木齐县| 清丰县| 博湖县| 连州市| 西华县| 上饶县| 凤山县| 永州市| 寿宁县| 晋城| 平塘县| 北碚区| 平邑县| 漳浦县| 久治县| 凯里市| 芮城县| 祁门县| 连云港市| 莱芜市| 兖州市| 大荔县| 建水县|