Ubuntu 16.04 VPS: LAMP + HTTP/2 Setup
Install LAMP using: sudo apt install lamp-server^
Prepare the build environment for the module by fetching the required libraries and Apache source.
Ensure you are logged in as a user with sudo privileges.
Start by navigating to your home directory.
cd ~
Retrieve the latest libnghttp2-dev package. Keep an eye on library updates, as you’ll need to rebuild the http2 module when this package is updated.
sudo apt-get install libnghttp2-dev
Now, set up your build directories.
mkdir apache2
cd apache2
In this step, replace ‘xx’ with the correct revision for the source you just downloaded. Locate the directory in the source, and you’ll find the specific directory you’re looking for. Note that this is the longest step and may take around 10 minutes.
apt-get source apache2
sudo apt-get build-dep apache2
cd apache2-2.4.xx
fakeroot debian/rules binary
At this stage, copy the binary module to the Apache modules directory.
sudo cp ./debian/apache2-bin/usr/lib/apache2/modules/mod_http2.so /usr/lib/apache2/modules/
Create a ‘http2.load’ file with the following content in the /etc/apache2/mods-available/ directory.
LoadModule http2_module /usr/lib/apache2/modules/mod_http2.so
LogLevel http2:info
Inside your hosts file located in /etc/apache2/sites-available, define the protocol order by inserting the ‘Protocols…’ line directly within the
SSL Hosts section:
Protocols h2 http/1.1
Non-SSL Hosts section:
Protocols h2c http/1.1
Congratulations! Restart Apache, and observe HTTP/2 in action in your access logs
