Skip to content

Commit

Permalink
Added use of php-fpm and http2 for hub
Browse files Browse the repository at this point in the history
Ticket: ENT-11440
Changelog: title
  • Loading branch information
craigcomstock committed Oct 16, 2024
1 parent 6a0ec7d commit 10bebe6
Show file tree
Hide file tree
Showing 11 changed files with 667 additions and 18 deletions.
2 changes: 1 addition & 1 deletion deps-packaging/apache/cfbuild-apache.spec
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ CPPFLAGS=-I%{buildprefix}/include
--prefix=%{prefix}/httpd \
--enable-so \
--enable-mods-shared="all ssl ldap authnz_ldap" \
--enable-http2 \
--with-z=%{prefix} \
--with-ssl=%{prefix} \
--with-ldap=%{prefix} \
--with-apr=%{prefix} \
--with-apr-util=%{prefix} \
--with-pcre=%{prefix}/bin/pcre2-config \
--with-mpm=prefork \
CPPFLAGS="$CPPFLAGS"

%build
Expand Down
1 change: 0 additions & 1 deletion deps-packaging/apache/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ build-stamp:
--with-apr=$(PREFIX) \
--with-apr-util=$(PREFIX) \
--with-pcre=$(PREFIX)/bin/pcre2-config \
--with-mpm=prefork \
CPPFLAGS="$(CPPFLAGS)"
make

Expand Down
18 changes: 13 additions & 5 deletions deps-packaging/apache/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,19 @@ LogLevel warn

</IfModule>


LoadModule php_module modules/libphp.so
AddHandler php-script .php
AddType application/x-httpd-php-source php

# Use mod_http2
LoadModule http2_module modules/mod_http2.so
# Prefer http2 protocol
Protocols h2 h2c http/1.1

# Setup php to be handled by php-fpm. Required for use of mod_http2 due to threading issues in php.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
# need to pass Authorization headers to fpm for API requests
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

<Directory "/var/cfengine/httpd/htdocs/public">

Expand Down
11 changes: 6 additions & 5 deletions deps-packaging/php/cfbuild-php.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version: %{version}
Release: 1
Source0: php-%{php_version}.tar.gz
Source1: php.ini
Source2: php-fpm.conf
License: MIT
Group: Other
Url: http://example.com/
Expand Down Expand Up @@ -45,10 +46,7 @@ LDFLAGS=""
--enable-mbstring \
--enable-sockets \
--disable-mbregex \
--without-fpm-user \
--without-fpm-group \
--without-fpm-systemd \
--without-fpm-acl \
--enable-fpm \
--without-layout \
--without-sqlite3 \
--without-bz2 \
Expand Down Expand Up @@ -113,7 +111,9 @@ make
%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{prefix}/httpd/conf
mkdir -p ${RPM_BUILD_ROOT}%{prefix}/httpd/php/etc
cp %{prefix}/httpd/conf/httpd.conf ${RPM_BUILD_ROOT}%{prefix}/httpd/conf
cp ${RPM_BUILD_ROOT}/../../SOURCES/php-fpm.conf ${RPM_BUILD_ROOT}%{prefix}/httpd/php/etc

INSTALL_ROOT=${RPM_BUILD_ROOT} make install

Expand Down Expand Up @@ -168,7 +168,8 @@ CFEngine Build Automation -- php -- development files
%prefix/httpd/php/lib
%prefix/httpd/php/bin
%prefix/httpd/php/php
%prefix/httpd/php/lib/php.ini
%prefix/httpd/php/etc
%prefix/httpd/php/sbin

%dir %prefix/httpd/modules
%prefix/httpd/modules/libphp.so
Expand Down
2 changes: 2 additions & 0 deletions deps-packaging/php/debian/cfbuild-php.install
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/var/cfengine/httpd/php/php
/var/cfengine/httpd/modules/libphp.so
/var/cfengine/httpd/php/lib/php.ini
/var/cfengine/httpd/php/etc/php-fpm.conf
/var/cfengine/httpd/php/sbin/php-fpm
7 changes: 3 additions & 4 deletions deps-packaging/php/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ build-stamp:
--enable-mbstring \
--enable-sockets \
--disable-mbregex \
--without-fpm-user \
--without-fpm-group \
--without-fpm-systemd \
--without-fpm-acl \
--enable-fpm \
--without-layout \
--without-sqlite3 \
--without-bz2 \
Expand Down Expand Up @@ -96,7 +93,9 @@ install: build
dh_installdirs

mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/httpd/conf
mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/httpd/php/etc
cp $(PREFIX)/httpd/conf/httpd.conf $(CURDIR)/debian/tmp$(PREFIX)/httpd/conf/httpd.conf
cp $(CURDIR)/php-fpm.conf $(CURDIR)/debian/tmp$(PREFIX)/httpd/php/etc/

INSTALL_ROOT=$(CURDIR)/debian/tmp CPPFLAGS="-I$(PREFIX)/include" LD_LIBRARY_PATH="$(PREFIX)/lib" LD_RUN_PATH="$(PREFIX)/lib" $(MAKE) install

Expand Down
Loading

0 comments on commit 10bebe6

Please sign in to comment.