nginx部署:

  • 依賴
1 [root@localhost ~]# yum install -y gcc gcc-c++ zlib-devel pcre pcre-devel openssl openssl-devel
  • 安裝
1 [root@localhost ~]# tar -zxvf nginx-1.15.12.tar.gz
2 [root@localhost ~]# cd nginx-1.15.12
3 [root@localhost ~]#./configure --prefix=/opt/context/nginx --with-http_ssl_module --with-http_stub_status_module 
  • 配置
1 [root@localhost conf]# cat /opt/context/nginx/conf/nginx.conf
2 
3 #添加一下信息
4 
5       location /nginx_status {
6             stub_status on;
7             access_log   off;
8         }
  • 檢測配置
[root@localhost ~]# /opt/context/nginx/sbin/nginx -t
nginx: the configuration file /data/soft/openresty/nginx/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /data/soft/openresty/nginx/nginx/conf/nginx.conf test is successful
  • 啟動
1 [root@localhost ~]# /opt/context/nginx/sbin/nginx 
  • 停止
1 [root@localhost ~]# /opt/context/nginx/sbin/nginx  -s stop
  • nginx_stattus

  http://192.163.4.58:18080/nginx_status

  Active connections: 1 
  server accepts handled requests
   2 2 3 
  Reading: 0 Writing: 1 Waiting: 0 
  • nginx_status詳解
  Active connections: 1     
  ##nginx正處理的活躍連接數(shù)
  
  server accepts handled requests
  ##server nginx啟動到現(xiàn)在共處理了多少個連接
  ##accepts nginx啟動到現(xiàn)在共創(chuàng)建了多少次握手,請求丟失數(shù)=握手數(shù)-連接數(shù)
  ##handled requests 總共處理了多少個請求
  Reading: 0 Writing: 1 Waiting: 0
  ##Reading nginx讀取客戶端 header 信息數(shù)
  ##Writing nginx返回給客戶端的 hearder 信息數(shù)
  ##Waiting nginx已經(jīng)處理完正在等待下一次請求指令的駐留連接,在開啟keep-alive的情況下,waiting值等于active - (Reading+Writing)