NGINX--基础使用

1、基础命令

yiifung@localhost sbin]$ ./nginx  -h 
nginx version: nginx/1.22.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: /home/yiifung/nginx/)
  -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

[yiifung@localhost sbin]$ 

2、命令详解

CommandOptionsDescription
./nginx-?,-h帮助,获取详细信息
./nginx-v获取版本信息
./nginx-V获取版本信息以及configure的各种选项
./nginx-t检查配置文件,是否符合语法规则
./nginx-s发送信号给主进程,stop 快速的shutdown掉服务、quit 优雅的杀掉服务、reload重新加载配置文件、reopen切割日志文件,重新打开日志文件,防止日志文件过大,不方便查找也不方便归档

nginx -s reopen 详解
先将原来的日志重新命名,然后nginx -s reopen

yiifung@localhost logs]$ ll
total 12
-rw-r--r--. 1 yiifung yiifung   92 May 22 07:14 access.log
-rw-r--r--. 1 yiifung yiifung 1579 May 22 07:20 error.log
-rw-r--r--. 1 yiifung yiifung    6 May 22 07:18 nginx.pid
[yiifung@localhost logs]$ mv  access.log  access.log_22
[yiifung@localhost logs]$ mv  error.log  error.log_22
[yiifung@localhost logs]$ ll
total 12
-rw-r--r--. 1 yiifung yiifung   92 May 22 07:14 access.log_22
-rw-r--r--. 1 yiifung yiifung 1579 May 22 07:20 error.log_22
-rw-r--r--. 1 yiifung yiifung    6 May 22 07:18 nginx.pid
[yiifung@localhost logs]$ ../sbin/nginx  -s reopen
[yiifung@localhost logs]$ ll
total 16
-rw-r--r--. 1 yiifung yiifung    0 May 22 07:21 access.log
-rw-r--r--. 1 yiifung yiifung   92 May 22 07:14 access.log_22
-rw-r--r--. 1 yiifung yiifung   61 May 22 07:21 error.log
-rw-r--r--. 1 yiifung yiifung 1579 May 22 07:20 error.log_22
-rw-r--r--. 1 yiifung yiifung    6 May 22 07:18 nginx.pid
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值