tutorials questions & answers
by

Ubuntu 16.04 VPS LAMP + HTTP/2

TAGS:
  • ubuntu
  • LAMP
  • HTTP/2

Install LAMP normally. The easiest way I know is: sudo apt install lamp-server^

Start by preparing your build environment for the module. This is done by retrieving the necessary libraries and the Apache source.

You will need to be logged in as a user with sudo privileges.

Begin by going to your home directory.

cd ~

Get the latest libnghttp2-dev package. You may want to watch for library updates, because when this updates - you will want to rebuild the http2 module.

sudo apt-get install libnghttp2-dev

Now prepare your build directories.

mkdir apache2
cd apache2

In this step, replace "xx" with the correct revision for the source you just downloaded. Just look in the directory and you'll find the directory you're looking for. This is the longest step, It might take 10 minutes.

apt-get source apache2
sudo apt-get build-dep apache2
cd apache2-2.4.xx
fakeroot debian/rules binary

At this point you can 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 this content in /etc/apache2/mods-available/

LoadModule http2_module /usr/lib/apache2/modules/mod_http2.so

<IfModule http2_module>
    LogLevel http2:info
</IfModule>

Inside of your hosts files in /etc/apache2/sites-available, define the protocol order, inserting the "Protocols..." line directly within the <VirtualHost>

SSL Hosts:

Protocols h2 http/1.1

Non-SSL Hosts:

Protocols h2c http/1.1

You're done! Restart Apache and watch the HTTP/2 scroll by in your access logs!

comments (2)

leave comment

Please choose login or register to comment in this thread.

Start now for as low as $5 a month!

  • 8 Characters
  • 1 Uppercase Atleast
  • 1 Number Atleast