VPS 및 전용 서버(호스팅 컨트롤 센터) 도움말

How to install Varnish on Ubuntu 14.04

Varnish is a caching engine used to speed up the delivery of your website. A speedy website is key to a great user experience. This article will show you how to install varnish using apt-get on Ubuntu 14.04

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
RELATED PRODUCTS CentOS-based VPS or dedicated servers

Installing Varnish on Ubuntu is simple, we can achieve this by using the built in package manager and pulling the package directly from varnish-cache.org. You will need to be logged in as root to complete this setup. First, we will install the necessary dependencies that Varnish requires:

apt-get install apt-transport-https

Now we need to retrieve the GPG Key from varnish-cache.org. We will be using the cURL command to achieve this, if you don't have cURL installed already you can run:

apt-get install curl

Now, to retrieve the key:

curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | apt-key add -

Next we need to add the repository to the apt sources, we will use the echo command to make it easy:

echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list

Now that we have added the repository to apt, we can install varnish:

apt-get update
apt-get install varnish

Congratulations, you have successfully installed Varnish on Ubuntu 14.04 - now we need to configure Apache.

Varnish is automatically configured to server content over port 80 and fetch contents from Apache on port 8080, we need to update Apache to serve content over port 8080.

First, lets update the port Apache listens on:

vi /etc/apache2/ports.conf

and update the following line to match the configuration below:


If you have any virtual hosts configured, you will need to update these as well - ensure your configuration looks like this:

Save and exit the file, and restart the services:

service apache2 reload
service varnish restart

You can check to see if varnish is working by typing the following command:


You have successfully installed Varnish on your Ubuntu server, you can test whether or not it is working by analyzing the headers or using a browser plugin.

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