User:Progandy/Playground

From ArchWiki
< User:Progandy
Revision as of 11:46, 18 March 2014 by Progandy (talk | contribs) (modified LAMP sections)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

modified LAMP sections

Using php5 with php-fpm, mod_proxy_fcgi and mod_proxy_handler

Note: Unlike the widespread setup with ProxyPass, the proxy configuration with mod_proxy_handler and SetHandler respects other Apache directices like DirectoryIndex. This ensures a better compatibility with software designed for libphp5, mod_fastcgi and mod_fcgid. If you still want to try ProxyPass, experiment with a line like this:
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/$1
  • Verify the values of these settings in /etc/php/php-fpm.conf:
listen = /run/php-fpm/php-fpm.sock
listen.owner = http
listen.group = http
listen.mode = 0660
  • Append following to /etc/httpd/conf/httpd.conf:
LoadModule proxy_handler_module modules/mod_proxy_handler.so
<Proxy "unix:/run/php-fpm/php-fpm.sock|fcgi://php-fpm.local/">
    # Register php-fpm unix socket with a fictional local domain
    # we must use ProxySet, so set min=0 which is the default anyways 
    ProxySet min=0
</Proxy>
<FilesMatch \.php$>
    # Send .php files to the unix socket
    SetHandler "proxy:fcgi://php-fpm.local/"
</FilesMatch>
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
  • Make sure /etc/php/php.ini has the directive enabled:
cgi.fix_pathinfo=1
# systemctl restart httpd.service php-fpm.service