博客
关于我
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/

你可能感兴趣的文章
php csv 导出
查看>>
php include和require
查看>>
php mysql优化方法_MySQL优化常用方法
查看>>
PHP OAuth 2.0 Server
查看>>
php openssl aes ecb,php openssl_encrypt AES-128-ECB iOS
查看>>
php paypal rest api,PayPal REST API指定网络配置文件PHP
查看>>
PHP pcntl_fork不能在web服务器中使用的变通方法
查看>>
php private ,public protected三者的区别
查看>>
php PSR规范
查看>>
php redis(2)
查看>>
PHP Redis分布式锁
查看>>
PHP SOAP模块的使用方法:NON-WSDL模式
查看>>
php zookeeper实现分布式锁
查看>>
PHP 使用 $_SERVER['PHP_SELF'] 获取当前页面地址及其安全性问题
查看>>
php 反射
查看>>
Redis入门
查看>>
PHP 截取字符串乱码的解决方案
查看>>
php 接口类与抽象类的实际作用
查看>>
PHP 插入排序 -- 折半查找
查看>>
PHP 支持8种基本的数据类型
查看>>