zoukankan      html  css  js  c++  java
  • 将nginx添加至service服务

    一、问题描述:

      无法用service命令启动nginx

      

    二、问题分析:

      /etc/init.d/目录下缺少nginx默认启动脚本

    三、问题解决:

      在/etc/init.d/路径下添加脚本文件,名称为nginx,并添加文件可执行权限:

      

      修改nginx启动脚本文件:  

    #!/bin/bash
    #Startup script for the nginx Web Server
    #chkconfig: 2345 85 15
    nginx=/usr/local/nginx/sbin/nginx
    conf=/usr/local/nginx/conf/nginx.conf
    case $1 in 
    start)
    echo -n "Starting Nginx"
    $nginx -c $conf
    echo " done."
    ;;
    stop)
    echo -n "Stopping Nginx"
    killall -9 nginx
    echo " done."
    ;;
    test)
    $nginx -t -c $conf
    echo "Success."
    ;;
    reload)
    echo -n "Reloading Nginx"
    ps auxww | grep nginx | grep master | awk '{print $2}' | xargs kill -HUP
    echo " done."
    ;;
    restart)
    $nginx -s reload
    echo "reload done."
    ;;
    *)
    echo "Usage: $0 {start|restart|reload|stop|test|show}"
    ;;
    esac

       

    四、问题验证:

      

  • 相关阅读:
    BZOJ 3189. [Coci2011]Slika
    BZOJ3188. [Coci 2011]Upit
    P4304 [TJOI2013]攻击装置
    P3966 [TJOI2013]单词
    P3964 [TJOI2013]松鼠聚会
    BZOJ 3157: 国王奇遇记
    设计模式--策略模式
    SSM整合步骤
    Mybatis笔记二
    Java调用WebService之Axis实现
  • 原文地址:https://www.cnblogs.com/starfish29/p/10570362.html
Copyright © 2011-2022 走看看