Nginx基本命令
1、Nginx幫助命令
nginx -h
[root@VM_0_2_centos sbin]# ./nginx -h#nginx版本號 nginx version: nginx/1.15.12#使用方法 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 #使用信號控制Nginx進程停止、放棄、重啟、重新讀取配置-p prefix : set prefix path (default: /data/software/nginx/) #設備Nginx的存放路徑-c filename : set configuration file (default: conf/nginx.conf) #讀取配置參數路徑-g directives : set global directives out of configuration file #指定附加配置的路徑2、Nginx啟動命令
nginx
[root@VM_0_2_centos sbin]# ./nginx [root@VM_0_2_centos sbin]# ps -ef | grep nginx root 20731 1 0 10:50 ? 00:00:00 nginx: master process ./nginx nobody 20732 20731 0 10:50 ? 00:00:00 nginx: worker process3、Nginx停止命令
nginx -s stop
[root@VM_0_2_centos sbin]# ./nginx -s stop [root@VM_0_2_centos sbin]# ps -ef | grep nginx root 20917 16297 0 10:51 pts/1 00:00:00 grep --color=auto nginx4、Nginx重啟
nginx -s reopen # Nginx進程之前必須存在 該過master進程和work進程不變
[root@VM_0_2_centos sbin]# ./nginx -s reopen [root@VM_0_2_centos sbin]# ps -ef | grep nginx root 21218 1 0 10:53 ? 00:00:00 nginx: master process ./nginx nobody 21219 21218 0 10:53 ? 00:00:00 nginx: worker process5、重新加載配置文件
nginx -s reload # Nginx進程之前必須存在,該過程master進程不變,但是work進程會重啟
[root@VM_0_2_centos sbin]# ./nginx -s reload [root@VM_0_2_centos sbin]# ps -ef | grep nginx root 21218 1 0 10:53 ? 00:00:00 nginx: master process ./nginx nobody 25522 21218 0 11:16 ? 00:00:00 nginx: worker process6、指定配置文件
nginx -c /conf/nginx.conf
[root@VM_0_2_centos sbin]# ./nginx -c /data/software/nginx/conf/nginx.conf [root@VM_0_2_centos sbin]# ps -ef | grep nginx root 28787 1 0 11:33 ? 00:00:00 nginx: master process ./nginx -c /data/software/nginx/conf/nginx.conf nobody 28788 28787 0 11:33 ? 00:00:00 nginx: worker process root 28801 16297 0 11:33 pts/1 00:00:00 grep --color=auto nginx7、測試配置文件正確性
nginx -t
[root@VM_0_2_centos sbin]# ./nginx -t #表示配置文件ok,如果錯誤會輸入文件哪一行錯誤 nginx: the configuration file /data/software/nginx/conf/nginx.conf syntax is ok nginx: configuration file /data/software/nginx/conf/nginx.conf test is successful總結
- 上一篇: node介绍和安装
- 下一篇: 【笔记】软件测试02——移动测试基础02