-

Nginx日常维护的命令

Linux

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,Nginx的安装不是很复杂,下面主要讲解下日常维护中Nginx常用的一些命令,以下命令都在Nginx的sbin目录下执行。

1、显示相关帮助
./nginx -h
nginx version: nginx/1.6.2
Usage: nginx [-?hvVtq] [-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
-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

2、检测配置文件
./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

3、启动 Nginx
./nginx

4、重载配置
./nginx -s reload

5、停止 Nginx
./nginx -s stop
./nginx -s quit
stop与quit参数的区别在于stop是快速停止nginx,可能并不保存相关信息,quit是完整有序的停止nginx,并保存相关信息。

6、指定配置文件
./nginx -c /usr/local/nginx/conf/nginx.conf

7、 查看 Nginx 版本
./nignx -v
nginx version: nginx/1.6.2

./nginx -V
nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
TLS SNI support enabled
configure arguments: –with-http_image_filter_module –with-http_ssl_module –with-http_gzip_static_module

来源:Nginx日常维护的命令

2 评论 “Nginx日常维护的命令

    请看小说阅读网 评论:
    2019年5月10日 下午9:35

    写的太经典了,我竟无言以对。

    吾读 评论:
    2019年5月10日 下午10:56

    写的太经典了,我竟无言以对。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注