在浏览器里查看Nginx和PHP-FPM的运行状态

查看Nginx状态

location /nginx_status {

stub_status on;

access_log off;

allow 127.0.0.1;

deny all;

}

curl http://127.0.0.1/nginx_status

http://nginx.org/en/docs/http/ngx_http_status_module.html

输出样例:

Active connections: 3

server accepts handled requests

17737 17737 49770

Reading: 0 Writing: 1 Waiting: 2

各项解释:

Active connections: 当前 Nginx 正处理的活动连接数.

server accepts handled requests: 总共处理了 17737 个连接, 成功创建 17737 次握手(证明中间没有失败的), 总共处理了 49770 个请求.

Reading: Nginx 读取到客户端的 Header 信息数.

Writing: Nginx 返回给客户端的 Header 信息数.

Waiting: 开启 keep-alive 的情况下, 这个值等于 Active - (Reading + Writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.

查看PHP-FPM状态

php-fpm.conf 中开启
pm.status_path = /status

nginx.conf 中配置:

location /status {

include        fastcgi_params;

fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_index  index.php;

fastcgi_pass   127.0.0.1:9000;

}

访问 http://127.0.0.1/status?full 查看状态信息(我只开了一个PHP-FPM工作进程):

pool:                 www

process manager:      static

start time:           27/Dec/2014:13:29:00 +0800

start since:          2571

accepted conn:        28

listen queue:         0

max listen queue:     0

listen queue len:     128

idle processes:       0

active processes:     1

total processes:      1

max active processes: 1

max children reached: 0

slow requests:        0

************************

pid:                  1275

state:                Running

start time:           27/Dec/2014:13:29:00 +0800

start since:          2571

requests:             28

request duration:     100

request method:       GET

request URI:          /status?full

content length:       0

user:                 -

script:               -

last request cpu:     0.00

last request memory:  0

附: 下面是php-fpm.conf里的说明

; The URI to view the FPM status page. If this value is not set, no URI will be

; recognized as a status page. It shows the following informations:

;   pool                 - the name of the pool;

;   process manager      - static, dynamic or ondemand;

;   start time           - the date and time FPM has started;

;   start since          - number of seconds since FPM has started;

;   accepted conn        - the number of request accepted by the pool;

;   listen queue         - the number of request in the queue of pending

;                          connections (see backlog in listen(2));

;   max listen queue     - the maximum number of requests in the queue

;                          of pending connections since FPM has started;

;   listen queue len     - the size of the socket queue of pending connections;

;   idle processes       - the number of idle processes;

;   active processes     - the number of active processes;

;   total processes      - the number of idle + active processes;

;   max active processes - the maximum number of active processes since FPM

;                          has started;

;   max children reached - number of times, the process limit has been reached,

;                          when pm tries to start more children (works only for

;                          pm ‘dynamic‘ and ‘ondemand‘);

; Value are updated in real time.

; Example output:

;   pool:                 www

;   process manager:      static

;   start time:           01/Jul/2011:17:53:49 +0200

;   start since:          62636

;   accepted conn:        190460

;   listen queue:         0

;   max listen queue:     1

;   listen queue len:     42

;   idle processes:       4

;   active processes:     11

;   total processes:      15

;   max active processes: 12

;   max children reached: 0

;

; By default the status page output is formatted as text/plain. Passing either

; ‘html‘, ‘xml‘ or ‘json‘ in the query string will return the corresponding

; output syntax. Example:

;   http://www.foo.bar/status

;   http://www.foo.bar/status?json

;   http://www.foo.bar/status?html

;   http://www.foo.bar/status?xml

;

; By default the status page only outputs short status. Passing ‘full‘ in the

; query string will also return status for each pool process.

; Example:

;   http://www.foo.bar/status?full

;   http://www.foo.bar/status?json&full

;   http://www.foo.bar/status?html&full

;   http://www.foo.bar/status?xml&full

; The Full status returns for each process:

;   pid                  - the PID of the process;

;   state                - the state of the process (Idle, Running, ...);

;   start time           - the date and time the process has started;

;   start since          - the number of seconds since the process has started;

;   requests             - the number of requests the process has served;

;   request duration     - the duration in μs of the requests;

;   request method       - the request method (GET, POST, ...);

;   request URI          - the request URI with the query string;

;   content length       - the content length of the request (only with POST);

;   user                 - the user (PHP_AUTH_USER) (or ‘-‘ if not set);

;   script               - the main script called (or ‘-‘ if not set);

;   last request cpu     - the %cpu the last request consumed

;                          it‘s always 0 if the process is not in Idle state

;                          because CPU calculation is done when the request

;                          processing has terminated;

;   last request memory  - the max amount of memory the last request consumed

;                          it‘s always 0 if the process is not in Idle state

;                          because memory calculation is done when the request

;                          processing has terminated;

; If the process is in Idle state, then informations are related to the

; last request the process has served. Otherwise informations are related to

; the current request being served.

; Example output:

;   ************************

;   pid:                  31330

;   state:                Running

;   start time:           01/Jul/2011:17:53:49 +0200

;   start since:          63087

;   requests:             12808

;   request duration:     1250261

;   request method:       GET

;   request URI:          /test_mem.php?N=10000

;   content length:       0

;   user:                 -

;   script:               /home/fat/web/docs/php/test_mem.php

;   last request cpu:     0.00

;   last request memory:  0

;

; Note: There is a real-time FPM status monitoring sample web page available

;       It‘s available in: ${prefix}/share/fpm/status.html

;

; Note: The value must start with a leading slash (/). The value can be

;       anything, but it may not be a good idea to use the .php extension or it

;       may conflict with a real PHP file.

; Default Value: not set

;
pm.status_path = /status

时间: 2024-08-01 12:33:41

在浏览器里查看Nginx和PHP-FPM的运行状态的相关文章

浏览器里查看请求头

参考: http://stackoverflow.com/questions/1651113/firefox-plugin-or-way-to-monitor-all-request-data-including-headers-and-contentFirebug + Tamper Data is the best couple of firefox toolsLive HTTP headers

通过浏览器查看nginx服务器状态配置方法

通过浏览器查看nginx服务器状态配置方法 投稿:junjie 字体:[增加 减小] 类型:转载 这篇文章主要介绍了通过浏览器查看nginx服务器状态配置方法,本文讲解开启nginx-status的配置方法,并对服务器的参数做了详细讲解,需要的朋友可以参考下 复制代码 代码如下: location /nginx-status { stub_status on; #access_log /var/log/nginx/mmt_nginx_status.log; access_log off; all

如何查看nginx状态?如何统计访问量?

nginx是个什么玩意儿本文不再多说,直奔主题! 1. 如何查看nginx的状态? stub_status 模块介绍 stub_status 模块主要用于查看Nginx的一些状态信息. 本模块默认是不会编译进Nginx的,如果你要使用该模块,则要在编译安装Nginx时指定: ./configure –with-http_stub_status_module 一.查看已安装的 Nginx 是否包含 stub_status 模块 #/usr/local/nginx/sbin/nginx -V 如果包

linux如何查看nginx是否启动

Nginx是一个高性能的反向代理服务器,现在一般作为我们网站或其他Web服务的第一层代理,用户在浏览器请求首先经过的就是Nginx服务. 如果Nginx服务没有启动或异常结束,将会影响Web服务的正常使用. 下面我将在Linux中查看Nginx是否启动的过程记录,分享出来. 工具/原料 Linux Nginx 通过进程判断 1 第一种方法:查看进程列表并过滤 Linux每个应用运行都会产生一个进程,那么我们就可以通过查看Nginx进程是否存在来判断它是否启动. 用ps -ef列出进程列表,然后通

LogStation 支持浏览器实时查看日志

我们在logback 分布式日志汇总中已经将日志输出到了all.logs,LogStation支持浏览器实时查看日志,适合研发和运维彼此独立的场景:研发没有服务器权限,却想看日志实时输出.再配合nginx提供的auth_basic简单授权就搞定了. 快速上手:logstation wget http://t.xlongwei.com/softwares/logstation-0.3.10.jar //初次运行会生成配置文件logstation.conf,编辑配置后再次运行即可,监听端口8884

IndexedDB: 浏览器里内置的数据库简介

一.概述: 所有的应用程序都需要"数据"支持.对于大多数的Web应用程序来说,数据是在服务器端进行组织和整理,然后由客户端(浏览器端)通过网络请求获取.随着浏览器的处理能力不断增强,可以在浏览器端存储和操纵应用程序需要的数据,因此越来越多的网站开始考虑,将大量数据储存在本地客户端,这样可以减少用户等待从服务器端获取数据的时间. 现有的浏览器端数据储存方案,都不适合储存大量数据.Cookie不超过4KB,且每次请求都会发送回服务器端:Window.name属性缺乏安全性,且没有统一的标准

PHP限制网页只能在微信内置浏览器中查看并显示

微信现在算是火了,围绕微信开发的应用也越来越多了,前段时间,自己公司需要,用PHP写了一个微信应用,为了防止自己辛苦写成的PHP应用被盗用,于是通过PHP做了限制,只能在微信自带的浏览器中才能打开本应用,一开始无头绪,后经多查证,总算把这功能弄出来了,现在把具体的代码分享给大家. 1 2 3 4 5 6 7 8 <?php $useragent = addslashes($_SERVER['HTTP_USER_AGENT']); if(strpos($useragent, 'MicroMesse

查看nginx,apache,mysql,php的编译参数

查看nginx编译参数:/usr/local/nginx/sbin/nginx -V查看apache编译参数:cat /usr/local/apache2/build/config.nice查看mysql编译参数:cat /usr/local/mysql/bin/mysqlbug | grep CONFIGURE_LINE查看php编译参数:/usr/local/php/bin/php -i | grep configure

微信浏览器里location.reload问题

微信浏览器里location.reload问题会导致有时候post数据丢失.建议不要用此方式,尽量ajax方式获取或不要为了获取新的UI而刷新页面 2015-12-26 00:51:34array ( 'goods' => array ( 'num' => '1', 'goods_id' => '166', 'pmt_id' => '', ), 'isfastbuy' => '1', )2015-12-26 00:52:22array ( )