8000 添加监控状态信息 · jaywcjlove/nginx-tutorial@9456065 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9456065

Browse files
committed
添加监控状态信息
1 parent 331985f commit 9456065

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Nginx版本:`1.11.5`
6262
- [跨域问题](#跨域问题)
6363
- [跳转到带www的域上面](#跳转到带www的域上面)
6464
- [代理转发](#代理转发)
65+
- [监控状态信息](#监控状态信息)
6566
- [代理转发连接替换](#代理转发连接替换)
6667
- [ssl配置](#ssl配置)
6768
- [强制将http重定向到https](#强制将http重定向到https)
@@ -1146,6 +1147,44 @@ server {
11461147
}
11471148
```
11481149

1150+
### 监控状态信息
1151+
1152+
通过 `nginx -V` 来查看是否有 `with-http_stub_status_module` 该模块。
1153+
1154+
> `nginx -V` 这里 `V` 是大写的,如果是小写的 `v``nginx -v`,则不会出现有哪些模块,只会出现 `nginx` 的版本
1155+
1156+
```nginx
1157+
location /nginx_status {
1158+
stub_status on;
1159+
access_log off;
1160+
}
1161+
```
1162+
1163+
通过 http://127.0.0.1/nginx_status 访问出现下面结果。
1164+
1165+
```bash
1166+
Active connections: 3
1167+
server accepts handled requests
1168+
7 7 5
1169+
Reading: 0 Writing: 1 Waiting: 2
1170+
```
1171+
1172+
1. 主动连接(第 1 行)
1173+
1174+
当前与http建立的连接数,包括等待的客户端连接:3
1175+
1176+
2. 服务器接受处理的请求(第 2~3 行)
1177+
1178+
接受的客户端连接总数目:7
1179+
处理的客户端连接总数目:7
1180+
客户端总的请求数目:5
1181+
1182+
3. 读取其它信(第 4 行)
1183+
1184+
当前,nginx读请求连接
1185+
当前,nginx写响应返回给客户端
1186+
目前有多少空闲客户端请求连接
1187+
11491188
### 代理转发连接替换
11501189

11511190
```nginx

0 commit comments

Comments
 (0)
0