View nginx StatusLocation/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
Sample output:
Active Connections:3
Server accepts handled requests
17737 17737 49770
reading:0 writing:1 Waiting:2
Various explanations:
Active connections: The number of active connections currently being processed by Nginx.
Server accepts handled requests: a total of 17,737 connections were processed, 17,737 handshakes were successfully created (proving that there was no failure in the middle), and a total of 49,770 requests were processed.
Reading:nginx the number of Header messages read to the client.
Writing:nginx the number of Header information returned to the client.
Waiting: When Keep-alive is turned on, this value equals Active-(Reading + Writing), meaning that Nginx has processed the host connection that is waiting for the next request instruction.
View PHP-FPM StatusOpen Pm.status_path =/status in php-fpm.conf
Configuration in 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;
}
Access Http://127.0.0.1/status?full View status information (I've only opened a PHP-FPM worker process):
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
attached:Here are the instructions in php-fpm.conf.
; The URI to view the FPM status page. If This value was not set, no URI would 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 with
; PM ' dynamic ' and ' OnDemand ');
; Value is 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 would 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 is outputs short status. Passing ' full ' in the
; Query string would 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 are not in Idle state
; Because CPU calculation is doing 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 are not in Idle state
; Because memory calculation is do when the request
; Processing has terminated;
; If the process is in an Idle state and then informations was related to the
; Last request, the process has served. Otherwise informations is 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 is 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
Check the operation status of Nginx and PHP-FPM in the browser.