0
点赞
收藏
分享

微信扫一扫

Windows nginx 操作和配置

Windows nginx 操作和配置

Windows 上的 nginx 只是一个简单的程序,并不是以服务的形式存在的。
所以只需要操作原可执行文件即可。

一、下载解压

官方下载地址: ​​http://nginx.org/en/download.html​​​ 下载官方的文件,应该是个 zip 包,解压后,绿色的 nginx 文件就在里面,类似这样的结构:
Windows nginx 操作和配置_windows
这里面 nginx.exe 就是我们需要操作的主要文件。

二、使用

1. 一般的操作

你可以直接双击它来启动它,此时 nginx 使用的配置文件是 ​​./conf/nginx.conf​​ ,但不能实现指定配置文件,重新加载配置文件等操作。

2. 指令操作

也可以通过命令行来操作它,切换到当前 nginx 目录下, ​​nginx.exe -h​​ 可以查看它的使用帮助

# nginx.exe -h
nginx version: nginx/1.20.1
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

可以看到,操作主程序的指令是 ​​-s​​ 参数,有以后几个操作:

指令

说明

start nginx.exe

启动 nginx

nginx.exe -s stop

停止

nginx.exe -s quit

退出程序

nginx.exe -s reopen

重新打开

nginx.exe -s reload

重新加载配置文件

还可以使用 ​​-c​​​ 来指定程序加载的配置文件,如果不指定,会默认加载程序目录下的 ​​./conf/nginx.conf​​ 文件


举报

相关推荐

0 条评论