Http/2, Apache, & Lightsail

This post only covers the technical details of how to implement http/2 on an Apache web server running in Amazon Linux on Lightsail. It does not go into the details of what http/2 is or why use it. For that information, I suggest https://http2.github.io.

First you have to switch the Multi-Processing Modules (MPMs) from pre-fork (the default) to another one. I chose the event mpm for no particular reason.

To do this, edit /etc/httpd/conf.modules.d/00-mpm.conf and make the following changes …

Comment out the following line…

#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

… and uncomment the following line …

LoadModule mpm_event_module modules/mod_mpm_event.so

Next, you have to activate the http2 protocol. You can do this at the virtual host level or the server level.

I activated it at the server level by editing the /etc/http/conf/httpd.conf file and adding the following line…

Protocols h2 h2c http/1.1

After the changes are made, restart the server with the following command…

service httpd restart

Your apache server is now serving content using http/2.

You can verify that the server is handling http/2 by looking at the web server logs and looking for “HTTP/2.0”.

Something like this:

1.2.3.4 – – [07/Mar/2019:10:59:48 -0600] “GET / HTTP/2.0” 200 4646 “-” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36”

NOTE: web crawlers (Google, Bing, etc) will continue to use http/1.1, so don’t worry about that.

Related posts ...
Amazon Lightsail started offering a managed database service a few months ago. I took a
As a follow-on to my first post about Amazon Lightsail, here's some additional information that
Although not directly supported, it's quite possible to use the LetsEncrypt certbot client on Amazon
Ha! I'll be you thought this blog was dead. Well, truth be told, it was

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.