GoDaddy 도움말

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 Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 5 min
RELATED PRODUCTS 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.

HTTP/1.1 200 OK
Date: Tue, 18 Nov 2014 19:05:29 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Content-Type: text/html;charset=UTF-8
X-Varnish: 16
Age: 0
Via: 1.1 varnish-v4
Connection: keep-alive

Two key flags that you want to pay attention to that let you know Varnish is indeed working correctly:

X-Varnish: 16
Via: 1.1 varnish-v4

That is it, you have verified the functionality of Varnish on your server.


이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.