Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

Enable http2 on a Forge provisioned server

Link –

Added on 2016-04-28: newly provisioned Forge servers will now use http2 by default whenever you install an ssl certifcate.

Like mentioned in the post on how to upgrade PHP, I'm a big fan of Forge. By default sites provisioned by Forge use regular http. Let's learn how to enable http2.

The http2 protocol provides a lot of benefits over http. In short it'll make your website load much faster. If want to know how this protocol works under the hood watch this excellent video by Mattias Geniar or read this blogpost at Cloudflare. Here an interesting test by (again) Mattias that shows the potential speed improvements.

A prerequisite for using http2 is that you serve your website via an encrypted connection (note: this is not 100% true but virtually all major browsers won't support http2 via unencrypted connections). Thanks to LetsEncrypt you can get free ssl certificates. Watch this free video on Laracasts to learn how to install a LetsEncrypt certificate.

Support for http2 was introduced in Nginx 1.9.5. You can check the version number of your Nginx installation by running nginx -v. If you're on 1.9.5 or higher you're good. You just have to add http2 to a server block in the Nginx configuration:

server {
  listen 443 ssl http2;
  ...
}

The Chrome developer tools can be used to check if you're site is indeed using http2. The column "protocol" should display "h2".

http2

Don't be overwhelmed with sadness if you're running something below Nginx 1.9.5. Upgrading is easy! Only three instructions are needed to upgrade to, at the time of this writing, Nginx 1.9.14:

sudo add-apt-repository ppa:nginx/development
sudo apt-get update
sudo apt-get install nginx

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Comments

What are your thoughts on "Enable http2 on a Forge provisioned server"?

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.