Nginx(5):常用命令

6 篇文章 0 订阅
5 篇文章 0 订阅

介绍

针对Nginx中常用的命令进行介绍。
以下命令都是在nginx/sbin目录下进行。

命令

启用nginx

$ ./nginx

停用Nginx

# 快速停止nginx,即使当前nginx处于工作中,也会立即停止
$ ./nginx -s stop
# 延时停止nginx,只有当前nginx出于空闲状态中,才会停止,这种方式和上一种比起来更为优雅,推荐使用
$ ./nginx -s quit

检查nginx.conf

# 用于检查nginx.conf文件语法是否正确
$ ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

重新加载nginx.conf

# 在不用关闭启动的情况下,加载nginx.conf配置文件并立刻起效
$ ./nginx -s reload

查看nginx版本

$ ./nginx -v
nginx version: nginx/1.17.9

查看nginx详细信息

# 展示信息如下:
#   版本信息
#   依赖环境(gcc、openssl等)
#   是否开启了TNS SNI SUPPORT,该功能表明nginx是否开启了多个SSL证书支持
#   进行configure的参数
$ ./nginx -V
nginx version: nginx/1.17.9
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/run/nginx/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwcgi --http-scgi-temp-path=/var/temp/nginx/scgi --with-http_ssl_module

命令使用帮助

$ ./nginx -h
nginx version: nginx/1.17.9
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-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: /usr/local/nginx/)
  -c filename   : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值