Friday, May 1, 2015

php-fpm status configuration

http://wnapdlf.blogspot.kr/2015/04/php-fpmmepeventapache247-install-and.html

 

Before beginning,ee above if you want to php-fpm+apache2.4+mysql on ubuntu in case you do not know.^^

#ubuntu trusty 14.04
#During load-testing I want to know fpm-status. So, lots of searching and many help from worldwide bloggers.^^;
root@apm1:/etc/php5/fpm/pool.d# vi /etc/php5/fpm/pool.d/www.conf
;other configurations.
;comment out and change status to fpm-status
pm.status_path = /fpm-status

#Now apache2.4 configuration.
#
root@apm1:/etc/php5/fpm/pool.d# cat /etc/apache2/mods-enabled/fastcgi.conf
<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
    
        <Directory /usr/lib/cgi-bin>
              DirectoryIndex index.php
              #Order Deny,Allow
              #Deny from all
              Options All
              AllowOverride All
              Require all granted
        </Directory>
</IfModule>

root@apm1:/etc/php5/fpm/pool.d# cat /etc/apache2/sites-enabled/000-default.conf <VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName 10.0.0.21

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel debug ssl:warn
    LogLevel debug

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
        #status php-fpm
         

        #fastcgi php-fpm
    
        <LocationMatch "/fpm-status">
           SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
           SetHandler php5-fcgi-virt
           #Action php5-fcgi-virt /usr/lib/cgi-bin/php5-fcgi virtual
           #Action php5-fcgi-virt /php5-fcgi.fcgi virtual
           Action php5-fcgi-virt /php5-fcgi virtual
           Order deny,allow
           Deny from all
           Allow from 10.0.0.1
        </LocationMatch>
     
      

</VirtualHost>

#Restart php5-fpm and apache.
root@apm1:/etc/php5/fpm/pool.d# service php5-fpm restart; service apache2 restart
php5-fpm stop/waiting
php5-fpm start/running, process 23547
 * Restarting web server apache2                                         [ OK ]
root@apm1:/etc/php5/fpm/pool.d#
#with funkload testing..



I hope this simple configuration tip helpful.
Thanks.

No comments:

Post a Comment