Nginx improve TTFB latency tutorial

Introduction

Google page speed suggest to improve the TTFB. In this tutorial, we will focus on how to improve page speed with some changes on nginx configuration file.

Enable http2

When you enable http2 you will improve the ttfb speed. You will require to have nginx >= 19.5.

To enable http2 you need to do it per virtualhost, go to the site configuration file located at /etc/nginx/sites-available and append http2 to the listen:

listen 443 http2;

Restart nginx service

sudo service nginx restart

You should see an improvement on google page speed check for TTFB.