fcgi-app section defines how HAProxy Enterprise should connect to a FastCGI application. Each
fcgi-app keyword is followed by a label, such as php_fpm, to differentiate it from others.
fcgi-app php_fpm # Your configuration settings
Fcgi-app configuration examples
In the next configuration sample we have added a fcg-app section that configures how HAProxy Enterprise should connect to PHP-FPM server, which is a FastCGI implementation for PHP.
fcgi-app php_fpm # Your configuration settings # the directory that contains your PHP files on the remote server docroot
/var/www/myapp# the name of the PHP script to call if no other file name is given in the request URL index index.php # the regular expression that extracts the PHP file name from the request of the request URL path-info ^(/.+\.php)(/.*)?$ # sends FastCGI error messages to the log destination specified in the global section log-stderr global backend php_servers use-fcgi-app php_fpmserver s1 192.168.1.10:9000 proto fcgi
use-fcgi-app directive in backend php_servers instructs HAProxy Enterprise to use the
fcgi-app settings for that pool of servers. The
proto fcgi field also needs to be added for each
Connecting to a FastCGI application via a UNIX socket
HAProxy Enterprise can connect to a FastCGI application listening at an IP address, or to a UNIX domain socket, as shown in the configuration sample below.
Specifying a socket means that the FastCGI application runs localy and HAProxy Enterprise needs to be able to access this socket. The
group directive in the
global section adds HAProxy Enterprise to the group that owns the socket, which in our example is www-data.
/dev/loglocal0 user haproxy# PHP-FPM application's UNIX socket is owned by the www-data group group www-databackend php_servers use-fcgi-app php_fpmserver s1 /run/php/myapp.sockproto fcgi