Notice: failed to open file: /www/wwwroot/gongfang.ucday.com/./data/plugindata/freeaddon_editposttime.lang.php 在/etc/init.d/路径下关闭nginx失败 - 疑问解答 - 论坛-沈阳职业-信息工程学院研创工坊 - 信息工程学院-云运维工坊

在/etc/init.d/路径下关闭nginx失败

[复制链接]
  • 打卡等级:初来乍到
  • 打卡总天数:5
  • 打卡月天数:0
  • 打卡总奖励:30
  • 最近打卡:2023-12-21 08:54:23

2

主题

0

回帖

2

积分

新手上路

积分
2
发表于 2023-12-21 09:04:09 | 显示全部楼层
本帖最后由 GSW 于 2023-12-21 10:43 编辑

在/etc/init.d/路径下关闭nginx失败





这里报错,没有这个文件和目录

  
解决方法  ,在/etc/init.d/nginx下编译一个脚本文件
#vi /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/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 "nginx 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 /var/run/nginx.pid
}
# reload nginx service functions.
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
保存退出
设置文件访问权限
#chmod a+x /etc/init.d/nginx
现在在试一试


关闭nginx成功

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

举报

您需要登录后才可以回帖 登录 | 立即注册
快速回复 返回顶部 返回列表