View the running status of Nginx and PHP-FPM in a browser

Source: Internet
Author: User
View the running status of Nginx and PHP-FPM in a browser 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
Output example:
Active connections: 3
Server accepts handled requests
17737 17737 49770
Reading: 0 Writing: 1 Waiting: 2
Explanations:
Active connections: Number of Active connections currently being processed by Nginx.
Server accepts handled requests: a total of 17737 connections are processed, and 17737 handshakes are created successfully (proving that there is no failure in the middle). a total of 49770 requests are processed.
Reading: number of headers that Nginx reads to the client.
Writing: The number of headers that Nginx returns to the client.
Waiting: When keep-alive is enabled, this value is equal to Active-(Reading + Writing), meaning Nginx has processed the resident connection Waiting for the next request command.

View PHP-FPM statusEnabling pm. status_path =/status in the 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 have only one PHP-FPM worker enabled ):
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

Appendix:Below is a description in the 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 requests 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
; Pm 'dynamic 'and 'ondemomand ');
; 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
; 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
; Last request the process has served. Otherwise informations are related
; 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.