zoukankan      html  css  js  c++  java
  • nginx重启命令

    1.首先要弄清楚启动文件和配置文件在哪

    个人项目是放在: 

    nginx启动路径为/usr/local/openresty/nginx/sbin/nginx

    nginx配置文件为/usr/local/openresty/nginx/conf/nginx.conf

    2.相关命令

    一般是进入到启动路径sbin下对nginx做操作

    首先查看相关进程并关掉,下面是几种不同的方法:

    • 查看相关进程然后杀死该进程:ps -e | grep nginx 或者 ps aux | grep nginx 查询进程号(例如该进程号是6856) kill -QUIT 6856 或者 kill -TERM 6856 或者 kill -INT 6856 杀死该进程
    • 直接强行关闭nginx :killall -9 nginx (简单粗暴)

    然后就是启动nginx:

    • 可以先看下nginx配置是否正确:

      测试当前配置文件是否正确: nginx -t

      测试指定配置文件是否正确: nginx -t 指定配置文件路径

    • 然后启动:
      nginx(启动路径为默认路径)
      nginx -c /usr/local/openresty/nginx/conf/nginx.conf 指定对应的配置文件重启

    3.补充

    一般对nginx.confg文件修改后 要重写加载一下

    nginx -s reload (平滑重启) 不过该命令建立再nginx启动的情况下

    可以再打开个界面 tail -f 对应error.log 查看是否重启有其他问题

    cd - 返回上次目录  

  • 相关阅读:
    LeetCode:Plus One
    LeetCode:Text Justification
    LeetCode:Sqrt(x)
    LeetCode:Climbing Stairs(编程之美2.9-斐波那契数列)
    LeetCode:Simplify Path
    LeetCode:Edit Distance
    LeetCode:Set Matrix Zeroes
    LeetCode:Search in Rotated Sorted Array I II
    LeetCode:Search a 2D Matrix
    LeetCode:Sort Colors
  • 原文地址:https://www.cnblogs.com/qiangqiangqiang/p/9619411.html
Copyright © 2011-2022 走看看