Windows系统下载安装ngnix

一 nginx下载安装

nginx是HTTP服务器和反向代理服务器,功能非常丰富,在nginx官网首页,点击download

在download页面下,可以选择Stable version稳定版本,点击下载

将下载完成的zip解压即可,然乎在nginx所在的根目录下打开cmd窗口,执行nginx相关命令

二 nginx相关命令

启动nginx

D:\soft\nginx\nginx-1.26.1>start nginx,常用启动nginx命令

D:\soft\nginx\nginx-1.26.1>nginx -c nginx.conf文件路径,指定nginx.conf配置文件启动nginx命令,配置文件的路径可以是相对路径,也可以是绝对路径

停止nginx

D:\soft\nginx\nginx-1.26.1>nginx -s stop

D:\soft\nginx\nginx-1.26.1>nginx -s quit

stop命令可以快速停止nginx服务,quit命令可以完整有序的停止nginx服务

检测配置文件

D:\soft\nginx\nginx-1.26.1>nginx -t -c nginx.conf文件路径
nginx: the configuration file ./conf/nginx.conf syntax is ok
nginx: configuration file ./conf/nginx.conf test is successful

nginx命令中-c参数用于指定相应的nginx配置文件,-t命令用于检测配置文件语法的正确性

重新加载配置文件

D:\soft\nginx\nginx-1.26.1>nginx -s reload

当配置文件修改后,需要重新加载nginx服务,让配置文件生效

查询nginx的启动进程

D:\soft\nginx\nginx-1.26.1>tasklist /fi "imagename eq nginx.exe"

查询nginx版本

D:\soft\nginx\nginx-1.26.1>nginx -v
nginx version: nginx/1.26.1

D:\soft\nginx\nginx-1.26.1>nginx -V
nginx version: nginx/1.26.1
built by cl 16.00.30319.01 for 80x86
built with OpenSSL 3.0.13 30 Jan 2024
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs.msvc8 --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 --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre2-10.39 --with-zlib=objs.msvc8/lib/zlib-1.3.1 --with-http_v2_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_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-stream_realip_module --with-stream_ssl_preread_module --with-openssl=objs.msvc8/lib/openssl-3.0.13 --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

查看更多的nginx命令

D:\soft\nginx\nginx-1.26.1>nginx -h
nginx version: nginx/1.26.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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值