Nginx的常用命令(基本操作)

2021-07-04 17:33:35 字數 3321 閱讀 2978

1.啟動nginx

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx

[sudo] password for hadoop:

hadoop@ubuntu-2:/usr/local/nginx/sbin$

2.停止nginx

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -s stop
hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -s quit

其中s選項是向nginx傳送訊號的方式。

3.nginx過載配置

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -s reload

hadoop@ubuntu-2:/usr/local/nginx/sbin$ service nginx reload
其中後者採用的是非傳送訊號方式。

4.檢視nginx的版本

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -v

nginx version: nginx/1.9.2

檢視詳細資訊:

5.指定配置檔案

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -c /usr/local/nginx/conf/nginx.conf

6.檢查配置檔案是否正確

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./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

7.顯示幫助資訊

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -h

nginx version: nginx/1.9.2

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

或:

hadoop@ubuntu-2:/usr/local/nginx/sbin$ sudo ./nginx -?

nginx version: nginx/1.9.2

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

ps:以上只是一些基本操作,不涵蓋向master程序傳送訊號的命令。

Nginx 基本常用命令

檢視nginx 版本號 nginx v關閉 nginx nginx s stop啟動 nginx nginx.nginx s reload檢視nginx 版本號 ningx v關閉 nginx nginx.exe s stop 或者 nginx.exe s quitstop是快速停止nginx,可能...

nginx常用命令

root ta30 53 nginx pwd usr local nginx root ta30 53 nginx sbin nginx root ta30 53 nginx sbin nginx s stop root ta30 53 nginx sbin nginx s quit s都是採用向 ...

nginx 常用命令

poechant ubuntu sudo sbin nginxpoechant ubuntu sudo sbin nginx s stop poechant ubuntu sudo sbin nginx s quit s都是採用向 nginx 傳送訊號的方式。poechant ubuntu sudo...