VPS & Dedicated Servers (Hosting Control Center) Help

How to test Varnish using cURL

This article will show you how to test Varnish by analyzing the HTTP headers you receive from the cURL command. There are a multitude of other ways to test this, but I find using cURL to be the easiest.

DIFFICULTY
strong>

Basic - 1 | Medium - 2 | Advanced - 3
td>

TIME REQUIRED
strong>

5 min

RELATED PRODUCTS
strong>

Linux-based VPS or dedicated servers

Testing varnish is crucial to ensure your websites are being cached and served in a timely matter, here is a quick test to ensure Varnish is working.

First, log in to any server that has cURL installed, if it is not installed you can easily install it running:

Ubuntu -

apt-get install curl

CentOS -

yum install curl

Once cURL is installed, you can then test Varnish by analyzing the headers, we will use the capital I flag to retrieve only the headers.

curl -I http://127.0.0.1/

Replacing 127.0.0.1 with a domain that is hosted on your server, or if you are testing from the default document root - use your server IP. You should see a similar output depending on your configuration.