博客
关于我
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 | cloud-init,一个实用的 云计算 Python 库!
查看>>
python | code2flow,一个神奇的 Python 库!
查看>>
python | cudf,一个超实用的 Python 库!
查看>>
python | daphne,一个非常nice的 Python 库!
查看>>
python调用halcon
查看>>
python | doit,一个非常实用的 Python 库!
查看>>
python | easyocr,一个超厉害的 关于OCR的 Python 库!
查看>>
python | fastFM,一个高级的 Python 库!
查看>>
python | feature_engine,一个实用的 Python 库!
查看>>
python | filelock,一个超酷的 Python 库!
查看>>
python | fire,一个强大的 Python 库!
查看>>
python | flanker,一个神奇的 Python 库!
查看>>
python | flower,一个强大的 Python 库!
查看>>
python | funcy,一个超强的 提供函数式编程工具 Python 库!
查看>>
python | ggplot,一个超强的 Python 库!
查看>>
python | grab,一个强大的 Python 库!
查看>>
python | gunicorn,一个非常实用的 Python 库!
查看>>
python | h5py,一个无敌的关于 HDF5 的 Python 库!
查看>>
python | huey,一个非常厉害的 任务调度 Python 库!
查看>>
python | hypothesis,一个有趣的 Python 库!
查看>>