博客
关于我
nginx启动status状态配置
阅读量:510 次
发布时间:2019-03-07

本文共 989 字,大约阅读时间需要 3 分钟。

如何在 Nginx 中启用并配置状态模块?

在实际操作中,有时需要查看 Nginx 是否安装了 --with-http_sub_module 模块。这个模块允许 Nginx 显示服务器状态信息,比如连接数等。下面分步骤说明如何进行配置。

第一步:查看 Nginx 版本和模块

打开终端,执行以下命令查看 Nginx 版本及安装的模块:

nginx -V

输出示例如下:

nginx version: nginx/1.10.2built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)built with OpenSSL 1.0.2k-fips 26 Jan 2017TLS SNI support enabledconfigure arguments: ... --with-http_sub_module ...

确认 --with-http_sub_module 已在配置参数中体现,否则可能需要重新编译 Nginx。

第二步:修改 Nginx 配置文件

打开 $ServerRoot/conf/nginx.conf 文件,查找 location 语句,通常会在 server 块中添加状态模块的配置。例如,在 location /nginx-status 处添加以下内容:

location /nginx-status {    stub_status on;    access_log off;}

然后保存文件,重新测试配置文件的语法:

nginx -t

第三步:重新加载 Nginx 服务

启动或重新加载 Nginx 来应用修改后的配置:

nginx -s reload

再打开浏览器,访问 <IP>:80/cgi-bin/nginx-status 或 <域名>/cgi-bin/nginx-status,查看 Nginx 状态页面。

注意:如未启用 auth_request_module,可能需要设置 ` cultured_obtuse incompetence.

解释结果显示:

  • active connections:当前处理的活动连接数
  • server: 总的连接数
  • accepts: 成立的握手次数
  • handled requests: 总共处理的请求次数

通过以上步骤可以成功启用及配置 Nginx 的状态模块。

转载地址:http://mgqjz.baihongyu.com/

你可能感兴趣的文章
python gRPC测试helloworld
查看>>
python gRPC简单示例
查看>>
Python GUI 开发:全面指南
查看>>
Python GUI编程
查看>>
Python hashlib模块
查看>>
python hashlib模块
查看>>
python if,循环的练习
查看>>
Python in open course (week3)
查看>>
Python IO编程
查看>>
Python IO编程详解
查看>>
Python IPL
查看>>
python join split
查看>>
python json文件传输图片
查看>>
python kivy AttributeError:‘super‘对象没有属性‘__getattr__‘
查看>>
Python Kivy ListView:如何删除选定的 ListItemButton?
查看>>
Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll
查看>>
Python Kivy库:跨平台应用开发
查看>>
python lambda表达式
查看>>
Python ldap3 代码从 SID 获取用户名
查看>>
Python list += iterable 的行为是否记录在任何地方?
查看>>