Add HTTP2 Support on Virtualmin in Ubuntu 16.04

Reading Time: 3 minutes

If you follow along with the entire series of article for Virtualmin Installation, you would notice, Virtualmin does not support HTTP2 yet, considering Apache version was still on Apache/2.4.18.

If you have hesitation, run “apache2ctl -V” instead.

[email protected]:~# apache2ctl -V
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2019-04-03T13:34:47
Server's Module Magic Number: 20120211:52
Server loaded:  APR 1.6.2, APR-UTIL 1.6.0
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

To go about this, let us upgrade our Apache, then enable HTTP2.

What is HTTP/2?

HTTP/2 is the first major HTTP protocol update since 1997 when HTTP/1.1 was first published by the IETF. The new HTTP protocol is needed to keep up with the exponential growth of the web. The successor of HTTP/1.1 brings significant improvement in efficiency, speed and security and is supported by most modern web browsers. 

https://tools.keycdn.com/http2-test

Add Ondrej’s Launchpad PPA

sudo add-apt-repository ppa:ondrej/apache2 && sudo apt-get update

Install new version of Apache

sudo apt install apache2

If you are prompted to the question below, just select “N”. This should keep your currently-installed version.

Configuration file '/etc/apache2/apache2.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** apache2.conf (Y/I/N/O/D/Z) [default=N] ? n

If you wish to see the update version run apache2ctl -V again.

Enable HTTP2 in Virtualmin

Click Webmin > Servers > Apache Webserver > Global Configuration > Configure Apache Modules.

image-43-1024x423 Add HTTP2 Support on Virtualmin in Ubuntu 16.04
Apache Webserver in Virtualmin

Tick http2 and Click Enable Selected Modules to complete your changes.

image-44-1024x144 Add HTTP2 Support on Virtualmin in Ubuntu 16.04
Enable http2 in Virtualmin

Test HTTP2

To test your setup, get your domain that is hosted on your Virtualmin Droplet and visit https://tools.keycdn.com/http2-test. From here, enter your domain and see the result, for example:

image-45 Add HTTP2 Support on Virtualmin in Ubuntu 16.04
HTTP/2 Test in https://tools.keycdn.com/http2-test

On the other hand, you could check your Response Headers on your browser instead. You should have Upgrade: h2,h2c. For example:

image-46-1024x648 Add HTTP2 Support on Virtualmin in Ubuntu 16.04

At this point, you should be all set.

Source:

How to enable HTTP/2 Protocol on Ubuntu 16.04

Was this post helpful?

Leave a Reply

Close Menu