HTTP/2 SSL PHP7 MariaDB on Debian 9

Requirements to enable HTTP/2 in Apache2;

  • Apache 2.4.17 or above, HTTP/2 is supported from this version and upwards
  • Prefer Debian 9 because uprade the Apache 2.4.10 on Deb 8 very complicated
  • Enable HTTPS, HTTP/2 only work over HTTPS. Also, TLS protocol version>= 1.2 with modern cipher suites is required
  • PHP7 or above
#cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"

Update and upgrade the System then Install Apache2

#apt-get update -y && apt-get upgrade -y
#apt-get install apache2 -y
#apache2ctl -v
Server version: Apache/2.4.25 (Debian)

Enable and load mod_rewrite Apache2

#nano /etc/apache2/apache2.conf and replace “AllowOverride None” to “AllowOverride All”

#a2enmod rewrite
#a2enmod headers
#a2enmod expires

Install PHP7.0-FPM and other required components

#apt-get install php7.0-fpm -y && apt-get install php7.0-mysql -y && apt-get install php7.0-gd -y && apt-get install php-pear php7.0 -y

Disable the mod_php module to PHP-FPM mode

#a2dismod php7.0
ERROR: Module php7.0 does not exist!
#a2dismod mpm_prefork
Module mpm_prefork already disabled

Tell Apache to use PHP FastCGI, set the Apache use a compatible PHP implementation by changing mod_php to php-fpm (PHP FastCGI).

#a2enconf php7.0-fpm
#a2enmod proxy_fcgi
#a2enmod mpm_event
#systemctl restart apache2

Next Install SSL Certificate Apache Debian https://vpshelpdesk.com/2017/11/18/install-ssl-certificate-apache-debian

SSL test on Qualys SSL Labs Rating A Configuration https://vpshelpdesk.com/2020/03/30/ssl-test-qualys-ssl-labs-rating-configuration/

Activate HTTP/2 protocol on default-ssl.conf

Insert Protocols h2 h2c http/1.1 after <VirtualHost _default_:443> on /etc/apache2/sites-available/default-ssl.conf

#nano /etc/apache2/sites-available/default-ssl.conf

Then follow the command below

#a2enmod ssl
#a2enmod http2
#a2ensite default-ssl
#systemctl restart apache2

Check HTTP/2 at https://http2.pro https://tools.keycdn.com/http2-test 

Then install MariaDB

#apt-get -y install mariadb-server mariadb-client
#mysql_secure_installation

Leave a Reply

Your email address will not be published. Required fields are marked *