Enable HTTP2 Support in Apache

From Sympl Wiki
Revision as of 15:51, 11 April 2020 by 6np (talk | contribs)
Jump to navigation Jump to search

We managed to get http2 running one time for some developers who were working on PUSH in the Apache Web Server. I didn't document what we did at the time but have rerun the process since on a fresh Sympl server to test for this documentation. There are a few things that need to be mentioned before we start as there are some substantial changes to the system that need to be made for this to work.

MPM_event to replace MPM_prefork

The prefork MPM has substantial limitations when working with http2 namely in that each connection can only handle one request at a time. More details can be found on the apache website. Because of this we are going to switch the apache server to using the event MPM. The event MPM is not able to preload the PHP module so we will also need to install php-fpm to parse php on the server.

notes only, needs editing

 apt-get install -y php7.3-fpm 
 a2dismod php7.3 mpm_prefork
 a2enmod alias mpm_event proxy proxy_fcgi setenvif http2
 2enconf php7.3-fpm

to edit the sympl template files

 sed -E -i 's/php_admin_value (.*)/SetEnv php_admin_value \"\1\"/' /etc/sympl/apache.d/*.erb
 sed -E -i 's/php_admin_flag (.*)/SetEnv php_admin_flag \"\1\"/' /etc/sympl/apache.d/*.erb

if you have hand edited the configuration files and dont want to run sympl-web-configure --force

 sed -E -i 's/php_admin_value (.*)/SetEnv php_admin_value \"\1\"/' /etc/apache2/*-available/*.conf
 sed -E -i 's/php_admin_flag (.*)/SetEnv php_admin_flag \"\1\"/' /etc/apache2/*-available/*.conf
 apachectl -t
 sympl-web-configure --verbose