Setup PHP7 FPM status page for apache 2.4

peps03

Verified User
Joined
Oct 24, 2013
Messages
192
Location
Amsterdam
I've seem many tutorials on setting up a PHP-FPM status page for apache with php5X but none working with php7.

I set pm.status_path = /status in /usr/local/php70/etc/php-fpm.conf


I use nginx as a proxy.

So in: nano /etc/nginx/nginx-vhosts.conf i set:

location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
allow XXX.XXX.XXX.XXX;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}

So far /status still gives a 404 - So i don't need to set anything in the NGINX config?

What should i set in the apache config file?
/etc/httpd/conf/extra/httpd-vhosts.conf

The 3 lines below are suggested by Martynas here: http://forum.directadmin.com/showthread.php?t=51383

<FilesMatch "^ping|status$">
SetHandler "proxy:unix:/usr/local/php56/sockets/webapps.sock|fcgi://localhost"
</FilesMatch>

Should i set the above? And where?

Help much appreciated!
 
Last edited:
Hello,

Some general ideas without details:

1. don't change anything in nginx
2. PHP-FPM uses sockets, not TCP port
3. modify /usr/local/directadmin/data/templates/custom/php-fpm.conf (if missing copy from /usr/local/directadmin/data/templates/config/)
4. modify /usr/local/directadmin/data/templates/custom/virtual_host2*.conf (if missing copy from /usr/local/directadmin/data/templates/config/)
5. rewrite configs with ./build rewrite_confs
6. test in a browser.
 
Thanks for the Tips zEitEr!

If somebody could help me with the details on getting this fpm status page live, that would be amazing!
 
you've already modified /usr/local/php70/etc/php-fpm.conf the same way you should modify /usr/local/directadmin/data/templates/custom/php-fpm.conf

The 3 lines below are suggested by Martynas need to be added into /usr/local/directadmin/data/templates/custom/virtual_host2*.conf

Code:
[/COLOR][COLOR=#333333]<FilesMatch "^ping|status$">[/COLOR]
[COLOR=#333333]SetHandler "proxy:unix:/usr/local/php[/COLOR]|PHP1_RELEASE|[COLOR=#333333]/sockets/|USER|.sock|fcgi://localhost"[/COLOR]
[COLOR=#333333]</FilesMatch>

related:
https://help.directadmin.com/item.php?id=2
 
Hi zEitEr!
Thanks for the reply!

So i should remove the following from /etc/nginx/nginx-vhosts.conf again?

Code:
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
allow XXX.XXX.XXX.XXX;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}


The file /usr/local/directadmin/data/templates/custom/php-fpm.conf doesn't exist yet.
Should i create it and only paste:

Code:
pm.status_path = /status


/usr/local/directadmin/data/templates/custom/virtual_host2*.conf doesn't exist either, i should create it too and only paste:

Code:
<FilesMatch "^ping|status$">
SetHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost"
</FilesMatch>
 
Oh, one more question, i see "|PHP1_RELEASE|" in the code. This will automatically be replaced with the correct version of the first installed PHP version?

What if i also want to see the status of the second installed version of PHP, php7?
 
the first installed PHP version?

Not exactly that, to be more accurate it's the PHP version which is set to be the default for an user domain. Users are allowed to change PHP version which they want to run for their domains in Directadmin. So it might vary from domain to domain depending on global and user's settings.

What if i also want to see the status of the second installed version of PHP, php7?

It's OK then. In this case you might want to use:
status-php1, ping-php1 for PHP 1
status-php2, ping-php2 for PHP 2

or whatever else you want.
 
I have problem with config for php-fpm70 status page (apache 2.4)
add into fpm70 for this subdomain
in |Custom2| section -> pm.status_path = /status
in httpd conf for subdomain
<FilesMatch "^ping|status$">
RewriteEngine Off
SetHandler "proxy:unix:/usr/local/php70/sockets/szukamprac.sock|fcgi://localhost"
</FilesMatch>
Rewrite confs and when go to blog.szukampracy.pl/status have File not found.

add this
<FilesMatch "^ping|status$">
SetHandler "proxy:unix:/usr/local/php70/sockets/szukamprac.sock|fcgi://localhost"
</FilesMatch>
and have 404 error

another problem with apache status page ;/
I have add into /etc/httpd/conf/extra/httpd-info.conf
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
</Location>

and remove # before ExtendedStatus On

reset httpd and go to mydomain/server-status
Forbidden
You don't have permission to access /server-status on this server.
 
Same issue here

I've been working on this for a while. I've used the recipe from Koen Reiniers' dev blog which worked well, so I have php7-fpm fully operational for other purposes. The only thing I haven't checked out is the use of SSL with this, which isn't an issue here.

I'm working on a sandbox installation (Ubuntu xenial, v16.04.3 LTS), with an RFC-1918 address specified in /etc/hosts for the FQHN "wpds.xenial" ("wpds" => WordPress Development Sandbox). I've verified that vhosts are served and segregated by pool by php-fpm.

Apache's fastcgi.conf contains:
Code:
 <Directory "/usr/lib/cgi-bin">
     Require all granted
 </Directory>

The php7-fpm pool config contains the followong:
Code:
[wpds]
    user = wpds
    group = wpds
    listen = /run/php/php7.0-fpm.wpds.sock
    listen.owner = wpds
    listen.group = wpds
    listen.mode = 0666
   
    ....
    pm.status_path = /fpm-status

The per-vhost config file consists of the following:
Code:
<IfModule mod_fastcgi.c>
    AddHandler php7-fcgi-wpds .php
    Action php7-fcgi-wpds /php7-fcgi-wpds
    Alias /php7-fcgi-wpds /usr/lib/cgi-bin/php7-fcgi-wpds
    FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-wpds -socket /run/php/php7.0-fpm.wpds.sock -pass-header Authorization
</IfModule>

<VirtualHost *:80>
    <IfModule mod_fastcgi.c>
      <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
        SetHandler "php7-fcgi-wpds"
      </FilesMatch>
      <FilesMatch "^.*/fpm-status$"">
        SetHandler "php7-fcgi-wpds"
      </FilesMatch>
    </IfModule>
  ServerAdmin [email protected]
  DocumentRoot /home/wpds
  ServerName wpds.xenial
</VirtualHost>

If I run phpinfo() from a file in the DirectoryRoot (http://wpds.xenial/phpinfo.php), PHP correctly identifies Server API as FPM/FastCGI, and files created by the server process are correctly owned by the wpds user. On the other hand, trying http://wpds.xenial/fpm-status returns a 404 error. This should not be. The purpose of this exercise is to remove all factors except the invocation URL to demonstrate that the PHP FPM daemon is working for this installation, but for some reason isn't processing a status request, as it should.

I've found a lot of lot of questions on the Interent related to this issue for different web servers and distributions, but few, if any, notices that anyone has solved the problem, especially for apache2.4. I'm beginning to suspect a bug.
 
I have problem with config for php-fpm70 status page (apache 2.4)
add into fpm70 for this subdomain
in |Custom2| section -> pm.status_path = /status

Rewrite confs and when go to blog.szukampracy.pl/status have File not found.

add this

and have 404 error

another problem with apache status page ;/
I have add into /etc/httpd/conf/extra/httpd-info.conf


and remove # before ExtendedStatus On

reset httpd and go to mydomain/server-status

You have disabled access to server-status. Your severer needs to see, somewhere, the following directives. On my server (Ubuntu xenial w. apche2.4), they're in mods-enabled/server.conf, but you can put this anywhere it'll get parsed and read when your server starts.
Code:
<IfModule mod_status.c>
        # Allow server status reports generated by mod_status,
        # with the URL of http://servername/server-status
        # Uncomment and change the "192.0.2.0/24" to allow access from other hosts.

        <Location /server-status>
                SetHandler server-status
                Require local
        </Location>

        # Keep track of extended status information for each request
        ExtendedStatus On
</IfModule mod_status.c>
 
Back
Top