关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

云服务器安装nginx的stub_status模块

发布时间:2023/10/7 13:17:40
香港云服务器

[root@web1 ~]# vim /usr/local/nginx/conf/nginx.conf

47 location /status {

48 stub_status on;

49 }

# 检查语法,出现syntax is ok表示配置文件正确

[root@web1 ~]# /usr/local/nginx/sbin/nginx -t

# 启动服务

[root@web1 ~]# /usr/local/nginx/sbin/nginx

[root@web1 ~]# ss -tlnp | grep :80

LISTEN 0 128 *:80

# 访问监控页面

[root@web1 ~]# curl http://192.168.4.100/status

Active connections: 1

server accepts handled requests

1 1 1

Reading: 0 Writing: 1 Waiting: 0

# Activeconnections:当前客户端与nginx之间的连接数。它等于下面Reading / Writing/ Waiting之和

# accepts:自nginx启动之后,客户端访问的总量

# handled:自nginx启动之后,处理过的客户端连接总数。

# requests:自nginx启动之后,处理过的客户端请求总数。

# Reading:正在读取HTTP请求头部的连接总数。

# Writing:正在向客户端发送响应的连接总数。

# Waiting:空闲连接。

# 使用工具向服务器发起多个请求

[root@web1 ~]# yum install -y httpd-tools

# 一共发1000个请求,每次并发数100

[root@web1 ~]# ab -n 1000 -c 100 http://192.168.4.100/status

[root@web1 ~]# curl http://192.168.4.100/status

Active connections: 1

server accepts handled requests

1040 1040 1004

Reading: 0 Writing: 1 Waiting: 0