nginx的启动与关闭
[root@nginx ~]# #默认启动方式 [root@nginx ~]# which nginx /sbin/nginx [root@nginx ~]# nginx [root@nginx ~]# #另行指定配置文件 [root@nginx ~]# nginx -c /tmp/nginx.conf [root@nginx ~]# #另行指定配置文件 [root@nginx ~]# nginx -c /tmp/nginx.conf [root@nginx ~]# #另行指定nginx安装目录 [root@nginx ~]# nginx -p /usr/local/nginx/ [root@nginx ~]# #另行指定全局项启动方式 [root@nginx ~]# nginx -g "pid /var/nginx/test.pid;" [root@nginx ~]# #测试配置信息是否有错误 [root@nginx ~]# nginx -t [root@nginx ~]# #测试配置阶段不输出信息 [root@nginx ~]# nginx -t -q [root@nginx ~]# #显示版本 [root@nginx ~]# nginx -v nginx version: nginx/1.4.7 [root@nginx ~]# #显示编译阶段的参数 [root@nginx ~]# nginx -V nginx version: nginx/1.4.7 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --sbin-path=/sbin/nginx --conf-path=/etc/nginx/nginx.conf --with-cc=/usr/bin/gcc --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx --builddir=/user/local/nginx/objs --with-perl=/usr/bin/perl --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --http-proxy-temp-path=/tmp/nginx/proxy_temp --with-pcre --with-pcre=/usr/src/pcre --with-openssl=/usr/src/openssl --with-zlib=/usr/src/zlib --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_mp4_module --with-http_flv_module [root@nginx ~]# #快速的停止服务 [root@nginx ~]# nginx -s stop [root@nginx ~]# ps -ef | grep nginx root 20824 1597 0 06:47 pts/0 00:00:00 grep nginx [root@nginx ~]# nginx [root@nginx ~]# ps -ef | grep nginx root 20826 1 0 06:47 ? 00:00:00 nginx: master process nginx nginx 20827 20826 0 06:47 ? 00:00:00 nginx: worker process root 20829 1597 0 06:47 pts/0 00:00:00 grep nginx [root@nginx ~]# k kbd_mode keytool killall krb5-config kbdrate kill killall5 [root@nginx ~]# kill -s sigterm 20826 【=nginx -s stop】 [root@nginx ~]# ps -ef | grep nginx root 20831 1597 0 06:48 pts/0 00:00:00 grep nginx [root@nginx ~]# #"优雅的方式停止服务" [root@nginx ~]# nginx -s quit 【=kill -s SIGQUIT <nginx master pid>】 停止worker进程优雅【kill -s SIGWINCH <nginx worker pid>】 [root@nginx ~]# #允许的nginx重读配置文件 [root@nginx ~]# nginx -s reload [root@nginx ~]# #-s reopen 重新打开日志文件 [root@nginx ~]# nginx -s reopen [root@nginx ~]# nginx -h