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
查看详细信息:
hadoop@Ubuntu-2:/usr/local/nginx/sbin$ ./nginx -V
nginx version: nginx/1.9.2
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
built with OpenSSL 1.0.1 14 Mar 2012
TLS SNI support enabled
configure arguments: --with-http_ssl_module --add-module=/home/hadoop/ngx_http_anonymity_proxy_module --with-debug
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
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进程发送信号的命令。