首页 /服务器与软件/其它软件
 nginx for Win的命令
2025年6月14日 15:48
查看命令说明:nginx -h
查看nginx的版本号:nginx -v
启动nginx:start nginx
快速停止或关闭nginx:nginx -s stop
正常停止或关闭nginx:nginx -s quit
配置文件nginx.conf修改重装载命令:nginx -s reload

for Win 的版本,最新版也不支持UDP,因为没有 --with-stream_udp_module 模块。

先下载直接去官网 nginx.org

安装部署

1、下载完成后,解压缩,运行cmd,使用命令进行操作,不要直接双击nginx.exe,不要直接双击nginx.exe,不要直接双击nginx.exe

一定要在dos窗口启动,不要直接双击nginx.exe,这样会导致修改配置后重启、停止nginx无效,需要手动关闭任务管理器内的所有nginx进程,再启动才可以

2、使用命令到达nginx的加压缩后的目录

cd c:\nginx

3、启动nginx服务,启动时会一闪而过是正常的

start nginx

4、查看任务进程是否存在,dos或打开任务管理器都行

tasklist /fi "imagename eq nginx.exe"

打开任务管理器在进程中看不到nginx.exe的进程(双击nginx.exe时会显示在这里),需要打开详细信息里面能看到隐藏的nginx.exe进程。

修改完成后保存,使用以下命令检查一下配置文件是否正确,后面是nginx.conf文件的路径,successful就说明正确了

nginx -t -c conf/nginx.conf

如果程序没启动就直接start nginx启动,如果已经启动了就使用以下命令重新加载配置文件并重启

nginx -s reload

6、关闭nginx服务使用以下命令,同样也是一闪而过是正常的,看一下是否进程已消失即可

快速停止

nginx -s stop

完整有序的关闭

nginx -s quit


 
全部回复(1)
  • 引用1楼

    C:\nginx-1.28.0>nginx -h

    <strong>nginx version: nginx/1.28.0
    Usage: nginx [-?hvVtTq] [-s signal] [-p prefix]
                [-e filename] [-c filename] [-g directives]

    Options:
     -?,-h         : this help
     -v            : show version and exit
     -V            : show version and configure options then exit
     -t            : test configuration and exit
     -T            : test configuration, dump it and exit
     -q            : suppress non-error messages during configuration testing
     -s signal     : send signal to a master process: stop, quit, reopen, reload
     -p prefix     : set prefix path (default: NONE)
     -e filename   : set error log file (default: logs/error.log)
     -c filename   : set configuration file (default: conf/nginx.conf)
     -g directives : set global directives out of configuration file</strong>

    参数的大小写是有区别的。

  • 首页 | 电脑版 |