Page Speed For SEO | Varnish HTTPS Tutorial 2018

by Mal Tonge

Varnish With Https and Nginx fpm

Page Speed check list.

  1. Page speed SEO “Start Here” Part 1
  2. Page speed SEO – Setup free Cloudflare DNS
  3. Page Speed SEO – Nginx varnish php https for SEO


Make sure you have completed the previous crossed out links above before continuing with this Page speed SEO Tutorial.

OK Now you have all the information you need,  let’s get on with it!

Page speed SEO tutorial part 3 – Nginx | Varnish Https | PHP7.1 | Percona.

white hat seo 2017

White Hat SEO Guide 2017

Get exclusive access to my most valued Seo tips.



December 2018

































7th December 2018
12:00 pm
1:00 pm
2:00 pm
3:00 pm
4:00 pm
5:00 pm
6:00 pm
7:00 pm
8:00 pm
9:00 pm
10:00 pm
11:00 pm

Appointment details:

Page speed for SEO, In this section, I will show you how to get your server up and running using high-performance server-side software.  Below you will see a full list of software that we will install during this section of the page speed for SEO tutorial.

Software that will be installed and configured are.

  1. Nginx
  2. PHP 7.1
  3. PHP dependences
  4. Percona 5.7
  5. Varnish

By using the setup shown below, you can achieve vast gains in server speed and page load times,  without needing to spend a fortune of high priced servers.


Page speed for SEO really does impact your websites rankings, I’m going to tell you why!

When building its databases of results,  Google will look at user experience and user intent as the main ranking factors.  On average 50% of bounce rate comes down to site speed and page load times.  This will see your website drop in Google rankings, Due to user experience being so low because of your bounce rates.

Today is the day! say no more to slow speeds and give your website the boost it deserves!

To follow this page speed SEO seo tutorial more easily, I have created a step by step video.

Follow the Page speed for SEO video And Copy the code From here. Its the easiest way to follow this full SEO page speed guide Part 3.

Now you know what we will be doing during this section of the page speed SEO tutorial, lets get on with it.

The first thing to do is open up PuTTy and login to your server.  once logged in you will see similar to the image below.

Setup digital ocean for page speed Putty part 8

Now as long as you are logged in successfully as root then you are set to go.  The code below is given in sections you can just copy and past. To paste into Putty you just right click the mouse, nothing else.

As in all sections, you can choose to watch the full setup from my video listed below.  The code follows after.

This will add the sources required for PHP 7.1. illustration images will be provided throughout these steps


repo install

 Press enter when requested

Now we will add the percona repo to your source list. Use the below lines to achieve this.

percona 1 for page speed

percona for pagespeed
Now Update your repo list using the below code.

update repo for page speed

 Next we will install Nginx, Varnish and PHP 7.1 and Percona. With Page speed SEO in mind

install nginx varnish https
During the install, you will be required to enter a password for Percona.

type your password and hit enter.
You will need to confirm your password so go ahead and enter your password again.

Now we will configure our Nginx Server. Nginx is the actual server software, Nginx is vital for page speed SEO,  it’s the only server software you require,  it’s much faster than Apache and deals with requests that’s more in tune with the age of super fast internet and 4G connections on mobiles.  Meaning its super fast if configured correctly and vastly increases page speed for SEO.


The first step is to create a directory for your website by running the below code change to match your domain.

make directory for nginx
Nginx uses the user www-data so we will change the user ownership on your website directory. remember to replace with your URL

set permissions
The permissions should already be set correctly but just to make sure run the below command

775 www

now we will create an index.php file so we can test the server is rendering your pages.

run the below code make sure to change to match your domain

setup index
Then copy and paste the below HTML and past into the console


nginx server block

Save the file by using ctrl +x then Y then enter!

we will next create the server block for Nginx, Change the domain to match your domain

sites available

Now copy and paste from below into the console. remember to change all to match your domain.

The next step is to enable the Nginx server block, remember to change to match your domain.

sites enabledIf you are planning on creating more server blocks on the same server then we need to change a setting in our nginx.conf file in regards to
hash bucket memory issues. run the below

Now use the arrow keys and go down till you find the below line, and delete the “#”

#server_names_hash_bucket_size 64;

hash bucketonce the # has been deleted save the file by pressing ctrl and x then y then enter

 Next, we need to edit the listen to ports on the default Nginx file. use the below code and change the listen ports for “80” to “8080”

default 80 varnish

We need to now configure our SSL certificates with cloudFlare.  This is not so much a page speed factor for SEO but A SSL Certificate increases security for your visitors along with conversions.

First, we will create a directory for our certificates to live. Use the code below.

Next, we will create our certificate file.

Leave this empty file open for the time being whilst we go to CloudFlare and get our certificate and key.

head over to CloudFlare and log in as shown on day 2 of this tutorial then choose the crypto tab.

crypto setup

Now scroll down to Origin Certificates and click “create Certificate”

create cert

Cloudflare will show you a few options however we will not adjust any of them, So just click the next button.

options next

Now you will receive your certificate and Key, first copy the text from your certificate.

cert copy

then paste into the already open file in PuTTy then save using ctrl + x then Y then enter.

copy certNext, we will create the key for our certificate.

now go back to cloudflare and copy the key and then paste into PuTTy.

key copied

Save the key in PuTTy and exit CloudFlare

now check the Nginx config is working by running

if all is well you should see

  • nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  • nginx: configuration file /etc/nginx/nginx.conf test is successful

now restart nginx

restart nginxYour website will be unavailable at the moment this is because we have added the configuration for varnish within Nginx,
however, we have not yet setup Varnish. This is our next step.

Setup Varnish.

page speed varnish customCopy the below code and paste into the console, remember change all domain name references to match your domain.

Now save that file by holding ctrl and x then hit y and enter.

Next edit the default vcl by using the below code

varnish default page speedDelete all code from within that file by holding alt + A then use the down arrow to highlight.  once highlighted press ctrl + k to delete.

Now the file is clean copy and paste the below code.

Now create a link in your system.d folder by using the below code

varnish servicethen copy and paste from below.

save and exit.

Lets reload systemd service. run the below code.

now restart varnish

Restart Nginx

you should now have a working server running Nginx-fpm via varnish cache running with secure SSL

Now we will test our setup of varnish is actually working and serving varnish cached pages.  This can only be tested from the command line because varnish is passing the cache to nginx-fpm so online test tools will not work.

To do the test just past the below code into the command line.


Hey there, You’ve done a great job. I’ll certainly digg it and
recommend to my twitter followers personally. I’m confident
they’ll be benefited
from this website.

Leave Your Comment