Skip to content

Nginx--启动 重启 关闭 #5

Description

@iott

概览

启动

启动代码格式:nginx安装目录地址 -c nginx配置文件地址

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

停止

Step1:查看进程号

ps -ef|grep nginx

Step2:根据pid kill 进程

kill -QUIT 2072      //从容停止
kill -TERM 2132 或 kill -INT 2132   //快速停止
pkill -9 nginx    //强制停止

重启

  • 验证Nginx配置文件是否正确
    方式一:
    step1:进入Nginx安装目录sbin下
    step2:输入命令./nginx -t
    看到如下显示nginx.conf syntax is ok
    nginx.conf test is successful
    说明配置文件正确!
    方式二:
    在启动命令-c前加-t
    /usr/local/nginx/sbin/nginx -t  -c /usr/local/nginx/conf/nginx.conf
    
  • 重启Nginx服务
    方式一:进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可
    cd /usr/local/nginx/sbin
    ./nginx -s reload
    
    方式二:查找当前nginx进程号,然后输入命令:kill -HUP 进程号 实现重启nginx服务
    ps -ef|grep nginx
    kill -HUP 2255
    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions