ホームページ  >  記事  >  運用・保守  >  http_stub_status_module モジュールを nginx に追加する方法

http_stub_status_module モジュールを nginx に追加する方法

WBOY
WBOY転載
2023-05-19 19:28:042307ブラウズ

1. stub_status 関数の説明

##–with-http_stub_status_moduleNginx クライアントのステータス
コンパイル オプション 関数
2. 既存の nginx コンパイル パラメーターを確認します

./nginx -V
# 如果没有我们需要的模块,例如本次试验添加的 –with-http_stub_status_module ,那么则需要重新编译安装一下

http_stub_status_module モジュールを nginx に追加する方法

3 .Reconfigure 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/

http_stub_status_module モジュールを nginx に追加する方法

7 を置き​​換えます。 nginxを再起動し、コンパイルパラメータを確認します

./nginx -s reload
./nginx -V

8.公式サイトを参照

8.1 設定ファイルを変更します

ファイルディレクトリ:/usr/local/nginx/conf

http_stub_status_module モジュールを nginx に追加する方法

# 在文件中添加新的 location
location /nginx_status {
	stub_status;
}

# 解释说明:
	nginx_status	这是自定义命名的,访问的时候添加这个字段访问
	stub_status;	这个是固定参数

http_stub_status_module モジュールを nginx に追加する方法

8.2 ブラウザ アクセス

http://192.168.169.131/nginx_status
# 访问内容结果如下图

http_stub_status_module モジュールを nginx に追加する方法

# 解释说明:
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.

以上がhttp_stub_status_module モジュールを nginx に追加する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はyisu.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。