nginx如何添加http_stub_status_module模块
1. stub_status 作用说明
编译选项 | 作用 |
---|---|
–with-http_stub_status_module | Nginx的客户端状态 |
2.查看现有 nginx 编译参数
./nginx -V # 如果没有我们需要的模块,例如本次试验添加的 –with-http_stub_status_module ,那么则需要重新编译安装一下
3.使用参数重新配置configure,在原有基础上添加上 --with-http_stub_status_module
configure 文件是在安装包目录下的文件,具体可参考 centos 7 安装 nginx
./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_ssl_module --with-pcre --with-stream --with-http_stub_status_module
4.将原来的 nginx 文件备份
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
5. 编译
make # 这里是需要 make 编译,不用 make install
6. 替换nginx二进制文件
# 找到 nginx 安装包目录 /root/nginx-1.10.1/objs ,将 nginx 文件复制到原本的 /usr/local/nginx/sbin/nginx cp /root/nginx-1.10.1/objs/nginx /usr/local/nginx/sbin/
7.重新启动nginx,查看编译参数
./nginx -s reload ./nginx -V
8. 参考官网
8.1 修改配置文件
文件目录:/usr/local/nginx/conf
# 在文件中添加新的 location location /nginx_status { stub_status; } # 解释说明: nginx_status 这是自定义命名的,访问的时候添加这个字段访问 stub_status; 这个是固定参数
8.2 浏览器访问
http://192.168.169.131/nginx_status # 访问内容结果如下图
# 解释说明: 1)Active connections-活跃连接数 The current number of active client connections including Waiting connections. (2)accepts-已接受的客户端连接总数 The total number of accepted client connections. (3)handled-已处理的连接总数 The total number of handled connections. Generally, the parameter value is the same as acceptsunless some resource limits have been reached (for example, the worker_connections limit). (4)requests-客户端连接总数 The total number of client requests. (5)Reading-读取请求头的当前连接数 The current number of connections where nginx is reading the request header. (6)Writing-将响应写回客户端的当前连接数 The current number of connections where nginx is writing the response back to the client. (7)Waiting-等待请求的当前空闲客户端连接数 The current number of idle client connections waiting for a request.
以上是nginx如何添加http_stub_status_module模块的详细内容。更多信息请关注PHP中文网其他相关文章!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

在云服务器上配置 Nginx 域名的方法:创建 A 记录,指向云服务器的公共 IP 地址。在 Nginx 配置文件中添加虚拟主机块,指定侦听端口、域名和网站根目录。重启 Nginx 以应用更改。访问域名测试配置。其他注意事项:安装 SSL 证书启用 HTTPS、确保防火墙允许 80 端口流量、等待 DNS 解析生效。

确认 Nginx 是否启动的方法:1. 使用命令行:systemctl status nginx(Linux/Unix)、netstat -ano | findstr 80(Windows);2. 检查端口 80 是否开放;3. 查看系统日志中 Nginx 启动消息;4. 使用第三方工具,如 Nagios、Zabbix、Icinga。

可以通过以下步骤查询 Docker 容器名称:列出所有容器(docker ps)。筛选容器列表(使用 grep 命令)。获取容器名称(位于 "NAMES" 列中)。

可以查询 Nginx 版本的方法有:使用 nginx -v 命令;查看 nginx.conf 文件中的 version 指令;打开 Nginx 错误页,查看页面的标题。

启动 Nginx 服务器需要按照不同操作系统采取不同的步骤:Linux/Unix 系统:安装 Nginx 软件包(例如使用 apt-get 或 yum)。使用 systemctl 启动 Nginx 服务(例如 sudo systemctl start nginx)。Windows 系统:下载并安装 Windows 二进制文件。使用 nginx.exe 可执行文件启动 Nginx(例如 nginx.exe -c conf\nginx.conf)。无论使用哪种操作系统,您都可以通过访问服务器 IP

如何在 Windows 中配置 Nginx?安装 Nginx 并创建虚拟主机配置。修改主配置文件并包含虚拟主机配置。启动或重新加载 Nginx。测试配置并查看网站。选择性启用 SSL 并配置 SSL 证书。选择性设置防火墙允许 80 和 443 端口流量。

在 Docker 中创建容器: 1. 拉取镜像: docker pull [镜像名] 2. 创建容器: docker run [选项] [镜像名] [命令] 3. 启动容器: docker start [容器名]

Docker 容器启动步骤:拉取容器镜像:运行 "docker pull [镜像名称]"。创建容器:使用 "docker create [选项] [镜像名称] [命令和参数]"。启动容器:执行 "docker start [容器名称或 ID]"。检查容器状态:通过 "docker ps" 验证容器是否正在运行。
