to request this page, you have to set it up in fpm and configure nginx
(or another front web server) to access it.
For exemple in php-fpm.conf:
<value name="status">/status</value> // requesting /status will
return the status page
<value name="ping">/ping</value> // requesting /ping will return the
text set next
<value name="pong">pong</value> // requestint the previous parameter
will return pong
And in nginx.conf:
...
http {
server {
listen 80;
...
location ~ ^/(status|ping)$ {
include fastcgi_params;
fastcgi_pass backend;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
allow 127.0.0.1;
allow stats_collector.localdomain;
allow watchdog.localdomain;
deny all;
}
}
}
The request the web server:
# curl http://localhost:81/status.php
accepted conn: 2
pool: pool_1
process manager: static
idle processes: 3
active processes: 0
total processes: 3
# curl http://localhost:81/status.php?html
<table>
<tr><th>accepted conn</th><td>3</td></tr>
<tr><th>pool</th><td>pool_1</td></tr>
<tr><th>process manager</th><td>static</td></tr>
<tr><th>idle processes</th><td>3</td></tr>
<tr><th>active processes</th><td>0</td></tr>
<tr><th>total processes</th><td>3</td></tr>
# curl http://localhost:81/status.php?json
{"accepted conn":4,"pool":"pool_1","process manager":"static","idle
processes":3,"active processes":0,"total processes":3}
# curl http://localhost:81/ping.php
pong
enjoy
2010/2/23 Davy Campano <dcam...@gmail.com>:
It's a small amount of data so still human readable, but it is both
machine readable and human readable as JSON and allows for direct
Javascript consumption too; seems unnecessary to have multiple output
types. Jerome and I sparred over this in email a while back. :)
2010/2/23 Jérôme Loyet <m...@fatbsd.com>:
++ Jerome
2010/2/24 Michael Shadle <mik...@gmail.com>:
2010/2/23 Jérôme Loyet <m...@fatbsd.com>:
I didn't say it could'nt be discussed so Yes you can ! :)
I recommand not to choose a .php extension in order to NOT confuse
with a classic PHP file. This also makes you have two differents conf
in your webserver and this is better for security (you can restrict
access to the status and ping pages easily).
2010/2/24 任晓磊 <july...@gmail.com>:
yes you're right ... In my test env, it's called status.php to avoid
having 2 location in my nginx.conf.
my mistake
>Also, just wanted to
> thank you for your well done examples.
> Thanks
you're welcome