zoukankan      html  css  js  c++  java
  • Nginx状态信息(status)配置及信息详解

    nginx状态信息功能的介:

      Nginx 在编译安装 Nginx 的时候添加 --with-http_stub_status_module 参数,其功能是记录 Nginx 的基本访问状态信息,让使用者了解 Nginx 的工作状态,

    可以用 /application/nginx/sbin/nginx -V 来查看是否添加了ngx_http_stub_status_module 模块。

    例如:

     1、新建一个虚拟主机来配置 Nginx 状态信息功能

    cat  >>/application/nginx/conf/extra/status.conf<<eof
    ##status
    server{
        listen 80;
    server_name status.jyw1.com;
    location  /  {
    stub_status on;
    access_log off;
     }
    }
    eof

    2、修改nginx.conf配置文件

    [root@lamp01 conf]# cat nginx.conf
    worker_processes 1; error_log logs/error.log error; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #nginx vhosts config include extra/www.conf; include extra/bbs.conf; include extra/status.conf; access_log logs/access_www.log main; }

     

    3、刷新配置:

    [root@lamp01 conf]# /application/nginx/sbin/nginx -t
    nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok
    nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful
    [root@lamp01 conf]# /application/nginx/sbin/nginx -s reload

    4、修改本地 hosts解析

    echo "192.168.43.118 status.jyw1.com" >>/etc/hosts

    5、测试效果:

    状态信息解释:

    • Active connections :表示 Nginx 正在处理的活动连接数有多少个
    • server :表示 Nginx 启动到现在共处理了多少个连接
    • accepts :表示 Nginx 启动到现在共成功创建了多少次握手
    • handled requests : 表示总共处理了多少次请求
    • Reading :表示 Nginx 读取到客户端的 Header 信息数
    • Writing :表示 Nginx 返回给客户端的 Header 信息数
    • Waiting :表示 Nginx 已经处理完正在等候下一次请求指令的驻留连接数

    在开启 keep-alive 的情况下,Waiting = Active connections - (Reading + Writing)

  • 相关阅读:
    如何制定自己的博客园皮肤
    Notepad++ PluginManager安装常用插件
    Python进阶5---StringIO和BytesIO、路径操作、OS模块、shutil模块
    Python进阶4---Python的文件IO
    Python进阶3---python类型注解、functools
    dreamweavercs 和dreamweaver cc的區別
    Dreamweaver怎样用Edge Web Fonts功能
    vs code軟件操作
    vscode git設置
    git和svn的區別
  • 原文地址:https://www.cnblogs.com/su-root/p/10236252.html
Copyright © 2011-2022 走看看