Posts Tagged “ops”

Installing HTTP/2 on Ubuntu 16.04 with virtual hosts

Now that HTTP/2 is fairly stable and widely available, I decided to try and install and run it on this server. I’m currently running the Ubuntu 16.04.2 LTS with virtual hosts configured so I can serve a number of sites beyond this one. All of the sites this server hosts are also served securely using certificates from LetsEncrypt.

To install HTTP/2 I SSH’d in to the server and ran the following commands:

# add the new apache repository to your server's sources

sudo add-apt-repository -y ppa:ondrej/apache2

# update apache

sudo apt-key update

sudo apt-get update

# WARNING: answering yes at the prompts following this command will overwrite your apache.conf file located in /etc/apache2

sudo apt-get --only-upgrade install apache2 -y

# enable http2

sudo a2enmod http2

Next, navigate to /etc/apache2/sites-available and edit a virtual file of your choice, adding the following line after the ServerName declaration:

Protocols h2 h2c http/1.1

Finally, restart apache:

sudo service apache2 restart

Your site should now be served using http2. You can verify this using the KeyCDN tool located here.

Did I miss anything? Let me know.

Clearing mod_pagespeed cache

I use mod_pagespeed on this server to help speed up asset delivery and force optimization best practices across all of the sites I host. Occasionally, during deployments, it’s helpful to clear the module cache. Doing so is as simple as the following:

touch /var/cache/mod_pagespeed/cache.flush

Scotch Box for local LAMP development

Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.

If you spend any amount of time working on LAMP stack development projects you should take a look at Scotch Box. It’s a full-featured Vagrant Box and is far easier than fiddling with setting up a server directly on your dev machine.