1
0
Fork 0

add haproxy fastcgi option

This commit is contained in:
ibizaman 2022-09-28 23:34:03 -07:00
parent 3136d02127
commit 0705ce1c47

View file

@ -3,18 +3,38 @@
}: }:
{ serviceName { serviceName
, serviceSocket , serviceSocket
, phpFastcgi ? false
, phpDocroot ? null
, phpIndex ? "index.php"
}: }:
let
backend =
if !phpFastcgi
then ''
backend ${serviceName}
mode http
option forwardfor
server ${serviceName}1 ${serviceSocket}
'' else ''
backend ${serviceName}
mode http
option forwardfor
use-fcgi-app ${serviceName}-php-fpm
server ${serviceName}1 ${serviceSocket} proto fcgi
fcgi-app ${serviceName}-php-fpm
log-stderr global
docroot ${phpDocroot}
index ${phpIndex}
path-info ^(/.+\.php)(/.*)?$
'';
in
{ {
acl = '' acl = ''
acl acl_${serviceName} hdr_beg(host) ${serviceName}. acl acl_${serviceName} hdr_beg(host) ${serviceName}.
use_backend ${serviceName} if acl_${serviceName} use_backend ${serviceName} if acl_${serviceName}
''; '';
backend = '' inherit backend;
backend ${serviceName}
mode http
option forwardfor
server ${serviceName}1 ${serviceSocket}
'';
} }