nginx信息功能启用
2016-06-23 22:26
603 查看
--with-http_stub_status_module 这个模块功能是记录nginx基本信息访问状态
1、检查编译是否有这个功能模块。
[root@slave nginx]# /usr/sbin/nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --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/nginx.pid --lock-path=/var/lock/nginx.lock
--user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre
[root@slave nginx]#
2、在目录下添加server段
##status
server {
listen 80;
server_name status.wolf.com;
location / {
stub_status on;
access_log off;
}
}
3、添加hosts
[root@slave nginx]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.203 www.wolf.com bbs.wolf.com blog.wolf.com wolf.com status.wolf.com
笔记本添加
[root@slave nginx]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.203 www.wolf.com bbs.wolf.com blog.wolf.com wolf.com status.wolf.com
4、语法检查
[root@slave nginx]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
5、重启服务
[root@slave nginx]# /usr/sbin/nginx -s reload
6、测试
浏览器http://status.wolf.com/访问
Active connections: 5
server accepts handled requests
54 54 408
Reading: 0 Writing: 1 Waiting: 4
[root@slave nginx]# curl status.wolf.com
Active connections: 6
server accepts handled requests
55 55 414
Reading: 0 Writing: 1 Waiting: 5
7、访问限制
##status
server {
listen 80;
server_name status.wolf.com;
location / {
stub_status on;
access_log off;
allow 192.168.0.0/24;
deny all;
}
}
8、访问log说明
active connections – 活跃的连接数量
server accepts handled requests — 总共处理了11989个连接 , 成功创建11989次握手, 总共处理了11991个请求
reading — 读取客户端的连接数.
writing — 响应数据到客户端的数量
waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
1、检查编译是否有这个功能模块。
[root@slave nginx]# /usr/sbin/nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --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/nginx.pid --lock-path=/var/lock/nginx.lock
--user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre
[root@slave nginx]#
2、在目录下添加server段
##status
server {
listen 80;
server_name status.wolf.com;
location / {
stub_status on;
access_log off;
}
}
3、添加hosts
[root@slave nginx]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.203 www.wolf.com bbs.wolf.com blog.wolf.com wolf.com status.wolf.com
笔记本添加
[root@slave nginx]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.203 www.wolf.com bbs.wolf.com blog.wolf.com wolf.com status.wolf.com
4、语法检查
[root@slave nginx]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
5、重启服务
[root@slave nginx]# /usr/sbin/nginx -s reload
6、测试
浏览器http://status.wolf.com/访问
Active connections: 5
server accepts handled requests
54 54 408
Reading: 0 Writing: 1 Waiting: 4
[root@slave nginx]# curl status.wolf.com
Active connections: 6
server accepts handled requests
55 55 414
Reading: 0 Writing: 1 Waiting: 5
7、访问限制
##status
server {
listen 80;
server_name status.wolf.com;
location / {
stub_status on;
access_log off;
allow 192.168.0.0/24;
deny all;
}
}
8、访问log说明
active connections – 活跃的连接数量
server accepts handled requests — 总共处理了11989个连接 , 成功创建11989次握手, 总共处理了11991个请求
reading — 读取客户端的连接数.
writing — 响应数据到客户端的数量
waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
相关文章推荐
- nginx虚拟主机别名配置
- 使用nginx lua实现网站统计中的数据收集
- Nginx
- CentOS6编译安装Nginx-1.8.1
- Nginx 安装配置
- Nginx安装与使用
- nginx服务器下 PHP 出现 502 解决方案
- centos下nginx的负载均衡搭建(图文详解)
- Nginx安装lua-nginx-module模块
- Nginx上配置Basic Authorization登录认服务证的教程
- nginx :413 Request Entity Too Large
- Centos 6.5 下部署企业网站平台Nginx+PHP
- nginx配置文件详解
- nginx
- Kong:Nginx支持的API Gateway管理解决方案
- Nginx 模块自主开发二:Nginx的类型命名封装
- nginx1.8.0安装
- 解决haproxy代理nginx获取客户端真实ip问题
- Nginx配置文件说明
- nginx源码分析——事件模块