nginx的启动/关闭与重启

Nginx的基本信息检查:

检查配置文件的正确性:

  
  
  
  
  1. [root@ServerCenter www]# /opt/nginx/sbin/nginx -t  
  2. nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok  
  3. nginx: [warn] 65536 worker_connections exceed open file resource limit: 1024 
  4. nginx: configuration file /opt/nginx/conf/nginx.conf test is successful  
  5. [root@ServerCenter www]#   
  6. [root@ServerCenter www]# /opt/nginx/sbin/nginx -t -c /opt/nginx/conf/nginx.conf  
  7. nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok  
  8. nginx: [warn] 65536 worker_connections exceed open file resource limit: 1024 
  9. nginx: configuration file /opt/nginx/conf/nginx.conf test is successful  
  10. [root@ServerCenter www]# 

显示版本信息以及相关的编译信息:

  
  
  
  
  1. [root@ServerCenter www]# /opt/nginx/sbin/nginx -v  
  2. nginx version: nginx/1.2.4  
  3. [root@ServerCenter www]# /opt/nginx/sbin/nginx -V  
  4. nginx version: nginx/1.2.4  
  5. built by gcc 4.1.2 20080704 (Red Hat 4.1.2-52)  
  6. configure arguments: --with-http_stub_status_module --prefix=/opt/nginx  
  7. [root@ServerCenter www]# 

启动:

  
  
  
  
  1. [root@ServerCenter www]# ps -ef | grep nginx  
  2. root     13422 12848  0 17:31 pts/2    00:00:00 grep nginx  
  3. [root@ServerCenter www]#   
  4. [root@ServerCenter www]# /opt/nginx/sbin/nginx   
  5. nginx: [warn] 65536 worker_connections exceed open file resource limit: 1024  
  6. [root@ServerCenter www]#   
  7. [root@ServerCenter www]# ps -ef | grep nginx  
  8. root     13427     1  0 17:31 ?        00:00:00 nginx: master process /opt/nginx/sbin/nginx  
  9. nobody   13428 13427  0 17:31 ?        00:00:00 nginx: worker process  
  10. nobody   13429 13427  1 17:31 ?        00:00:00 nginx: worker process  
  11. nobody   13430 13427  1 17:31 ?        00:00:00 nginx: worker process  
  12. nobody   13431 13427  1 17:31 ?        00:00:00 nginx: worker process  
  13. root     13434 12848  0 17:31 pts/2    00:00:00 grep nginx  
  14. [root@ServerCenter www]# 

获取Nginx的PID信息:

  
  
  
  
  1. [root@ServerCenter ~]# ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'  
  2. 4007  
  3. [root@ServerCenter ~]#   
  4. [root@ServerCenter ~]# cat /opt/nginx/logs/nginx.pid   
  5. 4007  
  6. [root@ServerCenter ~]# 

发信号关闭Nginx:

  
  
  
  
  1. [root@ServerCenter ~]# kill -QUIT 4007  
  2. [root@ServerCenter ~]#   
  3. [root@ServerCenter ~]# ps -ef | grep --color nginx  
  4. root      4042  3958  0 22:08 pts/2    00:00:00 grep --color nginx  
  5. [root@ServerCenter ~]# 

 

你可能感兴趣的:(nginx)