Understanding Varnish Web Accelerator & Installation

Understanding Varnish Web Accelerator & Installation

Understanding Varnish Web Accelerator & Installation Process Varnish is a tool that accelerates the HTTP server and can act as a reverse proxy as well. Varnish can be installed as the front end to your web server (Apache or Nginx). Nginx uses the principle of storing the data in its cache rather than in the hard disk. We thus need to minimize the RAM memory allocated to Varnish to keep the costs down. The client or web server sends HTTP requests to varnish. Varnish then sends the requests to the web server. The web server returns the responses to Varnish. Varnish returns the responses to the client. The Varnish software also stores the http responses in its cache so that when it receives similar requests from the client it directly sends the responses rather than contacting the server and thus the process becomes much faster. The processing load in the web server is also reduced to a great extend by incorporating Varnish in between the client and the web server. Varnish effectively reduces the web server’s CPU load. It is well suited for websites with very high traffic. The websites will be very fast when Varnish is used. Installation of Varnish on a CentOS server Varnish is part of the EPEL repository and so we first install the EPEL repository. #rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7 -5.noarch.rpm #yum update #yum install varnish We start varnish as the root user. # service varnish start We can check and verify whether Varnish is running successfully through the below command: # service varnish status Next we can make sure tat the Varnish server automatically runs every time the server boots: # chkconfig –level 345 varnish on Next we move to the Varnish configuration file. The Varnish configuration files are /etc/sysconfig/varnish and /etc/varnish/varnish.vcl. /etc/sysconfig/varnish contains all the environment variables required for varnish to work properly. The file /etc/varnish/varnish.vcl contains the values for the caching policy of varnish. Varnish stands in between the client and the web server. Hence we need to make a few changes in the configuration. We change the default listening port of Varnish to port 80. We change the default port that the web server listens to port 8080. We then need to redirect the incoming traffic to Varnish to the web server. This is done automatically by Varnish once we have done the port settings correctly for both the Varnish server and for the web server. In our web server, say Apache or Ngnix make sure that we have set the server to listen on port 8080 instead of the default port i.e., port 80. For the Apache server, go to the configuration file /etc/httpd/conf/httpd.conf and make sure that the “Listen” parameter is set to port 8080 Listen 8080 For the Nginx server, goto the nginx configuration file /etc/nginx/nginx.conf and set the listen parameter to 8080 in the server block. We can test whether Varnish works correctly by executing the Curl command from the command line in our server. # curl -I http:// localhost Varnish also contains two tools named Varnish Cache that displays the Varnish stats and varnishlog that displays the varnish logs. Brought to you by ProlimeHost We’ve been in the web hosting industry for ten years, helping hundreds of clients succeed in what they do best and that’s running their business. We specialize in VPS and dedicated servers, with data centers in Los Angeles, Denver and Singapore. Call +1 877 477 9454 or email us at [email protected]. We’re here to help. .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us