zoukankan      html  css  js  c++  java
  • Windows下Nginx的启动、停止等命令

    Windows下Nginx的启动、停止等命令

    可以进入到nginx的安装根目录,执行nginx.exe -h

    在Windows下使用Nginx,我们需要掌握一些基本的操作命令,比如:启动、停止Nginx服务,重新载入Nginx等,下面我就进行一些简单的介绍。
    1、启动:

    C:server ginx-1.0.2>start nginx

    C:server ginx-1.0.2>nginx.exe

    注:建议使用第一种,第二种会使你的cmd窗口一直处于执行中,不能进行其他命令操作。

    如果需要特殊设置nginx的配置文件路径,可以这样执行start nginx -c conf/nginx.conf

    2、停止:

    C:server ginx-1.0.2>nginx.exe -s stop

    C:server ginx-1.0.2>nginx.exe -s quit

    注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息。

    执行 nginx.exe -s stop或者quit命令是不是不能删除进程?查看进程开了一堆nignx.exe
    还有80端口在Listening,并且浏览器F5刷新还能访问页面,可能nginx.exe版本或系统的原因,用
    taskkill /f /im nginx.exe > null 杀死nginx进程

    3、重新载入Nginx:

    C:server ginx-1.0.2>nginx.exe -s reload

    当配置信息修改,需要重新载入这些配置时使用此命令。

    4、重新打开日志文件:

    C:server ginx-1.0.2>nginx.exe -s reopen

    5、查看Nginx版本:

    C:server ginx-1.0.2>nginx -v

    nginx: nginx version: nginx/1.0.2

    C:server ginx-1.0.2>nginx -V

    nginx: nginx version: nginx/1.0.2 
    nginx: TLS SNI support enabled 
    nginx: configure arguments: --builddir=objs.msvc8 --crossbuild=win32 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-7.9 --with-zlib=objs.msvc8/lib/zlib-1.2.3 --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-mail --with-ipv6 --with-openssl=objs.msvc8/lib/openssl-0.9.8r --with-openssl-opt=enable-tlsext --with-http_ssl_module --with-mail_ssl_module

    注:v只是简单显示版本信息,V不但显示版本信息,还显示配置参数信息。

     <strong>注意不要直接双击nginx.exe,这样会导致修改配置后重启、停止nginx无效,需要手动关闭任务管理器内的所有nginx进程
     在nginx.exe目录,打开命令行工具,用命令 启动/关闭/重启nginx 
     start nginx : 启动nginx
     nginx -s reload  :修改配置后重新加载生效
     nginx -s reopen  :重新打开日志文件
     nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确
           关闭nginx:
     nginx -s stop  :快速停止nginx
     nginx -s quit  :完整有序的停止nginx
     如果遇到报错:
     bash: nginx: command not found
     有可能是你再linux命令行环境下运行了windows命令,
     如果你之前是允许 nginx -s reload报错, 试下 ./nginx -s reload
     或者 用windows系统自带命令行工具运行</strong>

    6、测试或载入指定配置文件:
    注意,修改了配置文件后最好先检查一下修改过的配置文件是否正 确,以免重启后Nginx出现错误影响服务器稳定运行。判断Nginx配置是否正确命令如下:

    C:server ginx-1.0.2>nginx.exe -t -c conf/default.conf

    nginx: the configuration file C:server ginx-1.0.2/conf/default.conf syntax isok
    nginx: configuration file C:server ginx-1.0.2/conf/default.conf test is successful

    载入指定配置文件

    C:server ginx-1.0.2>start nginx.exe -c conf/default.conf

  • 相关阅读:
    Vue生命周期
    Vue-Router
    Vue组件
    Vue基础以及指令
    ES6 常用语法
    缓存、序列化、信号
    四、全局事务的commit和rollback
    三、全局事务begin请求GlobalBeginRequest
    二、分布式事务协调者DefaultCoordinator
    一、seata-server的main启动方法
  • 原文地址:https://www.cnblogs.com/xiangxiushu/p/15523063.html
Copyright © 2011-2022 走看看