Nginx 服务器开启status页面检测服务状态

原文:http://www.cnblogs.com/hanyifeng/p/5830013.html

一、Nginx status monitor

  和apache 中服务器状态一样。输出的内容如:

  

    第1列:

  • 当前与http建立的连接数,包括等待的客户端连接:2

    第2列:

  • 接受的客户端连接总数目:20
  • 处理的客户端连接总数目:20
  • 客户端总的请求数目:50

    第3列:

  • 当前,nginx读请求连接
  • 当前,nginx写响应返回给客户端
  • 目前有多少空闲客户端请求连接

二、启用 status 条件

1.检查一下当前nginx的安装配置

[[email protected] ~]# nginx -V
nginx version: nginx/1.10.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --add-dynamic-module=njs-1c50334fbea6/nginx --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt=‘-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic‘
  1. 如果你的环境中可以看到有 --with-http_sub_module 这个模块,就代表可以启用status 。如果没有,可以在编译时加上。
  2. 现在编辑nginx 的配置文件。我们新建一个配置文件 /etc/nginx/conf.d/status.conf, 内容如下

    [[email protected] ~]# cat /etc/nginx/conf.d/status.conf
    server {
        listen 8080;
        access_log off;
        server_name localhost;
        root /var/www/html;
    
        location /nginx_status {
           stub_status on;
           access_log off;
           allow 223.xxx.xxx.xxx;
           allow 139.59.253.208;
           deny all;
    
        }
    
    }

对该页面的访问者进行了过滤,并禁用了访问写入log文件。

3.重启nginx后,在网站后面加上/nginx_status 即可。

http://101.201.238.125:8080/nginx_status

时间: 2024-08-05 14:22:05

Nginx 服务器开启status页面检测服务状态的相关文章

Nginx服务器开启GZip压缩的方法

常用配置片段如下: gzip             on;gzip_comp_level  2;                        # 压缩比例,比例越大,压缩时间越长.默认是1gzip_types       text/css text/javascript; # 哪些文件可以被压缩gzip_disable     "MSIE [1-6].";           # 无视IE6这个笨蛋~ 其中 gzip_types 选项默认只压缩 text/html,源码见: src

nginx启用status页面并实现nginx的登录账户认证

启用status页面并实现nginx的登录账户认证 开启status页面 1.查看编译安装时所编译的模块要开启status页面依赖于ngx_http_stub_status_module这个模块 [[email protected] ~]# nginx -V nginx version: nginx/1.14.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2

Nginx 之四: Nginx服务器的压缩功能

在Nginx服务器配置文件中可以通过配置Gzip的使用,可以配置在http块,server 块或者location块中设置,Nginx服务器可以通过ngx_http_gzip_module模块.ngx_http_static_module 模块功能ngx_http_gunzip_module模块对这些指令进行分析和处理. 一:ngx_http_gzip_module模块处理的指令: 1.gzip: 用于打开或者关闭gzip压缩的功能,用法如下: gzip on | off ; #默认为off 2

Nginx 服务器如何开启status检测

一.Nginx status monitor 和apache 中服务器状态一样.输出的内容如:  第1列: 当前与http建立的连接数,包括等待的客户端连接:2 第2列: 接受的客户端连接总数目:20 处理的客户端连接总数目:20 客户端总的请求数目:50 第3列: 当前,nginx读请求连接 当前,nginx写响应返回给客户端 目前有多少空闲客户端请求连接 二.启用 status 条件 检查一下当前nginx的安装配置 [[email protected] ~]# nginx -V nginx

查看nginx服务器状态

如何查看服务器状态信息(非常重要的功能) 1)编译安装时使用--with-http_stub_status_module开启状态页面模块 # nginx -s stop# cd # rm -rf /usr/local/nginx/# cd /root/lnmp_soft/nginx-1.12.2/# ./configure --with-http_ssl_module --with-stream --with-http_stub_status_module 开启SSL加密功能 开启TCP/UDP

通过浏览器查看nginx服务器状态配置方法

通过浏览器查看nginx服务器状态配置方法 投稿:junjie 字体:[增加 减小] 类型:转载 这篇文章主要介绍了通过浏览器查看nginx服务器状态配置方法,本文讲解开启nginx-status的配置方法,并对服务器的参数做了详细讲解,需要的朋友可以参考下 复制代码 代码如下: location /nginx-status { stub_status on; #access_log /var/log/nginx/mmt_nginx_status.log; access_log off; all

Nginx服务器搭建和基本配置详解

nginx Nginx(engine X) 是一个高性能的 HTTP 服务器和反向代理服务器,这款软件开发的目的是为了解决 C10k 问题. Nginx 的架构利用了许多现代操作系统的特性,以实现一个高性能的 HTTP 服务器.例如在 Linux 系统上,Nginx 使用了 epoll,sendfile,File AIO,DIRECTIO 等机制,使得 Nginx 不仅性能高效,而且资源占用率非常低,官方宣称 nginx 维持 10000 个非活动的 HTTP keep-alive 连接仅需要

Centos7   Nginx 服务器的安装配置

一. Nginx 简介 Nginx 是由俄罗斯软件工程师 Igor Sysoev 开发的一个高性能的 HTTP 和反向代理服务器,具备 IMAP/POP3 和 SMTP 服务器功能. 作为 Web 服务器:相比较与 Apache, Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率,这点使 Nginx 尤为受到虚拟主机提供商的欢迎,能够支持高达 50000 个并发的连接数的响应. 作为负载均衡服务器: Nginx 既可以在内部直接支持 Rails 和 PHP,也可以支持作为 HTTP

Nginx服务器的搭建

<--目录--> 1)Nginx理论 2)Nginx搭建 [Nginx理论] Nginx技能要点 Nginx安装与配置 Nginx虚拟主机 Nginx反向代理 一.nginx简介(能够提供网站服务 和 代理服务 开源软件) Nginx是俄罗斯人编写的十分轻量级的HTTP服务器 是一个高性能的HTTP和反向代理服务器,同时也是一个 IMAP/POP3/SMTP代理服务器 网站服务器类型 Apache Nginx tomcat(java语言编写) nginx 默认地址重写(修改用户访问的url)