1

Not sure if I'm out of bounds here, but I originally posted this on ask Ubuntu here

I have php5-fpm running just fine. My entire site is running as expected, almost no issues. However, I am unable to make use of the ping and status pages. When I navigate to mydomain.com/status or mydomain.com/ping I get an error (403, 404, 500, depends on the config).

I'm very new to the LAMP stack. I've been thrown to the wolves on this, but I've got to get it figured out.

I'll include anything I think is pertinent below, but if I miss something cue me in, thanks in advance for your patience!

Running Ubuntu 14.04
Apache 2.4
PHP 5.5

Mods enabled in Apache (the important ones at least):

  • mpm_event
  • fastcgi
  • actions
  • alias

I'm going to leave out the majority of the fpm configuration because it is functioning, but here's the ping and status settings... Pretty vanilla setup.

pm.status_path = /status
ping.path = /ping

Listening on a socket to reduce tcp/ip overhead...

listen = /var/run/php5-fpm.sock

I have php5-fpm.conf configured in /etc/apache2/conf-available/ and a symlink in conf-enabled, the contents of which are:

<IfModule mod_fastcgi.c>

    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

    <LocationMatch "/(ping|status)">
        SetHandler php5-fcgi-virt
        Action php5-fcgi-virt /php5-fpm-handler.fcgi virtual
    </LocationMatch>

</IfModule>

Most of the documentation I've found makes reference to the LocationMatch as the only hotfix needed to get the ping and status pages working. I'm not sure where to go from here. I've tried everything I can find on the web to no avail. I've made various changes to the php5-fpm.conf file and each change either has no effect or leads me to a different error. I've encountered internal server error's, permissions issues, etc. With this setup I'm currently getting a 500 internal server error.

All help is beyond appreciated! Thank you!


EDIT 09Feb2015:

After reading this helpful guide here I've replaced the LocationMatch in php5-fpm.conf with:

<FilesMatch "^ping|status$">
    SetHandler php-script
</FilesMatch>

This did not fix the problem, but did change the effect. I'm now receiving a 404 Error. Still not sure what I'm missing here...


EDIT 10Feb2015:

I've gone back to the more popular notion that the "LocationMatch" is correct and the "FilesMatch" will not get me closer to success. Again, very new to hosting and LAMP servers in general, but I found that when I get a 404 Error (using the "FilesMatch) nothing is logged in /var/log/apace2/error.log, but when using the "LocationMatch" I still get a 500 Error, and I get a log entry:

[Tue Feb 10 00:29:17.216917 2015] [core:error] [pid 8978:tid 140200547378944] [client IP:Port] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

I've done a little digging around the web, but cannot find good documentation describing a fix for this issue. Any Ideas?

  • Thanks for the updates, and providing the answer here as well. In the future, please try to avoid cross-posting questions on more than one Stack Exchange site, which is frowned upon. Instead, just flag the question if you feel it should be migrated to another site. Thanks. – dan Feb 13 '15 at 10:01
  • @dan thank you for the tip. If you would suggest it I will take it down from one site or the other as both the question and answer are identical on both sites. – Erick Christian Feb 13 '15 at 15:20
  • No worries, you pointed to the question on the other site and it might be helpful here too. It's just something to avoid in the future, and something I have to point out since some users blanket the SE sites with the same question in hopes of getting a quick answer. We're always happy to have good quality questions with followups like this here. – dan Feb 14 '15 at 1:00
2

Credit to Harold Snel on Ask Ubuntu for answering this for me... He said:

I had the same problem. With lots of Google-ing and trying I figured it out.

You need to match what you setup in your virtual host with whats configured in the fastcgi.conf (of php-fpm.conf).

Furthermore its beter to use '/fpm-status' and '/fpm-ping' in the /etc/php5/fpm/pool.d/www.conf config. Then you should not have conflicts with Apache's own 'status' page.

So this is my fastcgi.conf:

<IfModule mod_fastcgi.c>
    AddType application/x-httpd-fastphp5 .php
    Action application/x-httpd-fastphp5 /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
    <Directory /usr/lib/cgi-bin>
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Require all granted
            Order allow,deny
            Allow from all
    </Directory>
</IfModule>

And this is what I added in my Apache 000-default.conf:

<LocationMatch "/(fpm-ping|fpm-status)">
     SetHandler php5-fcgi-virt
     Action php5-fcgi-virt /php5-fcgi virtual
</LocationMatch>

If you don't limit access to your default Apache vhost you should add it in the LocationMatch for the fpt-ping and fpm-status:

     Order deny,allow
     Deny from all
     Allow from <your-IP>

To allow using php-fpm per virtual host just keep the 'standard' libphp.so and add this next lines to your virtual host to redirect all php files to the php-fpm:

    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
            SetHandler application/x-httpd-fastphp5
    </FilesMatch>

Happy php-fpm'ing!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.