How To Install & Configure Varnish with Apache on Ubuntu - PowerPoint PPT Presentation

About This Presentation
Title:

How To Install & Configure Varnish with Apache on Ubuntu

Description:

Presented by VEXXHOST, provider of OpenStack based public and Private Cloud Infrastructure – PowerPoint PPT presentation

Number of Views:11
Slides: 8
Provided by: VEXXHOSTPrivateCloud
Category:

less

Transcript and Presenter's Notes

Title: How To Install & Configure Varnish with Apache on Ubuntu


1
(No Transcript)
2
How To Install Configure Varnish with Apache on
Ubuntu
  • Varnish is an HTTP accelerator designed for
    content-heavy dynamic web sites.
  • In contrast to other web accelerators, such as
    Squid, which began life as a client-side cache,
    or Apache and nginx, which are primarily origin
    servers, Varnish was designed as an HTTP
    accelerator.
  • Varnish is focused exclusively on HTTP, unlike
    other proxy servers that often support FTP, SMTP
    and other network protocols.
  • Before we install Varnish, we should have apache
    already installed. To install Apache, we should
    simple execute
  • sudo apt-get install apache2

3
How To Install Configure Varnish with Apache on
Ubuntu
  • Varnish should be available for install in the
    standard Ubuntu repositories.
  • However, before we uninstall it we need to make
    sure that we are going to import the correct and
    latest varnish repository.
  • We will start with importing their key
  • sudo curl http//repo.varnish-cache.org/debian/
    GPG-key.txt sudo apt-key add -
  • Then, we should open /etc/apt/sources.list file
    for editing and add the following line
  • deb http//repo.varnish-cache.org/ubuntu/ lucid
    varnish-3.0

4
How To Install Configure Varnish with Apache on
Ubuntu
  • We need make sure that our repositories are
    up-to-date.
  • After then, we are ready to install Varnish.
  • sudo apt-get update
  • sudo apt-get install varnish
  • Once we have Varnish installed, we should setup
    some basic configuration parameters.
  • By default, Varnish will listen on port 80, so we
    need to edit Apache configuration and set apache
    to listen on different port.
  • In order to change that port that Apache listens
    on another port, we should open
    the /etc/apache2/ports.conf file and edit as
    follows
  • NameVirtualHost 127.0.0.18080
  • Listen 127.0.0.18080

5
How To Install Configure Varnish with Apache on
Ubuntu
  • Then, we should also make changes in the default
    virtual host file (and in every other virtual
    host file that exists)
  • ltVirtualHost 127.0.0.18080gt
  • In order to set varnish parameters, we should
    open the default Varnish configuration
    file, /etc/default/varnish, using our favorite
    editor, and uncomment the following directive
  • DAEMON_OPTS"-a 80
  • -T localhost6082
  • -f /etc/varnish/default.vcl
  • -S /etc/varnish/secret
  • -s malloc,256m"

6
How To Install Configure Varnish with Apache on
Ubuntu
  • That is all that we need to change in that file.
    Next, we open /etc/varnish/default.vcl file and
    edit as follows
  • backend default
  • .host "127.0.0.1"
  • .port "8080"
  • Please note that in 8080 is the port on which
    Apache listens.
  • If we choose another port for Apache to listen
    on, that we should use that port number instead.
  • We are done with the basic configuration.
  • Next, we need to restart the services and all
    traffic will go through Varnish
  • sudo service apache2 restart sudo service
    varnish restart

7
How To Install Configure Varnish with Apache on
Ubuntu
  • If we want to check the current Varnish status
    and the cached sessions and content that is
    served through Varnish, we should execute
  • varnishstat
  • Hitrate ratio 3 3 3
  • Hitrate avg 0.3745 0.3745 0.3745
  • 869844 4.97 2.89 Client connections
    accepted
  • 31200592 164.04 103.52 Client requests
    received
  • 11705560 58.66 38.84 Cache hits
  • Your pages are not being cached using Varnish and
    you can start by further referring to Varnish
    documentation to optimize your configuration.
Write a Comment
User Comments (0)
About PowerShow.com