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正处理的活跃连接数
  
  server accepts handled requests
  ##server nginx启动到现在共处理了多少个连接
  ##accepts nginx启动到现在共创建了多少次握手,请求丢失数=握手数-连接数
  ##handled requests 总共处理了多少个请求
  Reading: 0 Writing: 1 Waiting: 0
  ##Reading nginx读取客户端 header 信息数
  ##Writing nginx返回给客户端的 hearder 信息数
  ##Waiting nginx已经处理完正在等待下一次请求指令的驻留连接,在开启keep-alive的情况下,waiting值等于active - (Reading+Writing)