High performance HTTP accelerator varnish installation and configuration

Source: Internet
Author: User
Tags varnish

Guide Varnish is a high-performance, open-source Reverse proxy server and HTTP accelerator that incorporates a new software architecture and is tightly aligned with today's hardware architecture. Let me give you a brief talk about his installation and configuration. installation Installing Pcre

If you do not have Pcre installed, you will be prompted to find the Pcre library when compiling varnish 2.0 or later, and the Pcre library is intended to be compatible with regular expressions, so you must first install the Pcre library. Here is the installation process for Pcre:

[[email protected] ~]# TAR-ZXVF pcre-7.9.tar.gz[[email protected] ~]# CD Pcre-7.9/[[email protected] ~]#./config--p  Refix=/usr/local/pcre/[[email protected] ~]# make && make install
Installing varnish

Here, install the varnish into the/usr/local/directory and operate as follows:

[[email protected] ~]# TAR-ZXVF varnish-2.1.2.tar.gz[[email protected] ~]# CD Varnish-2.1.2[[email protected] ~]# export Pkg_config_path=/usr/local/pcre/lib/pkgconfig[[email protected] ~]#./configuer  --prefix=/usr/local/varnish >--enable-dependency-tracking>--enable-debugging-symbols>--enable-developer-warnings[[email protected] ~]# Make[[email protected] ~]# make Install[[email protected] ~]# CP redhat/varnish.initrc   /etc/init.d/varnish[[ Email protected] ~]# CP redhat/varnish.sysconfig  /etc/syscinfug/varnish

where "Pkg_config_path" is the path that specifies varnish to find the Pcre library, the varnish installation is complete.

Configuration

Due to space limitations, here is the meaning of the introduction of VCL built-in functions, please forgive us!

vcl_recv function

Used to accept and process requests. When the request is reached and successfully received, it is invoked to determine how the request is processed by judging the requested data.
This function usually ends with the following keywords:

>pass: To enter the pass mode and give the request control to the Vcl_pass function. >pipe: To enter the pipe mode, please give the request control to the Vcl_pipe function. >error code [reason]: means to return "code" to the client and discard processing of the request.
vcl_pipe function

This function is called when it enters pipe mode, and is used to pass the request directly to the back-end host, returning the unchanging content to the client without changing the contents of the request and return until the connection is closed.
This function usually ends with the following keywords:

>pipe: To enter the pipe mode, please give the request control to the Vcl_pipe function. >error code [reason]: means to return "code" to the client and discard processing of the request.
Vcl_pass function

This function is called when it enters pass mode and is used to pass requests directly to the back-end host. The back-end host sends the reply data to the client after the data is answered, but does not make any caches and returns the latest content each time under the current connection.
This function usually ends with the following keywords:

>pass. >error code [reason]: means to return "code" to the client and discard processing of the request.
Lookup

Indicates that the requested object is found in the cache, and the control is given to the Vcl_hit or function Vcl_miss based on the result of the lookup.

vcl_hit function

After the lookup instruction is executed, the function is called automatically when the requested content is found in the cache.
This function usually ends with the following keywords:

>pass: To enter the pass mode and give the request control to the Vcl_pass function. >deliver: Indicates that the found content is sent to the client and gives control to Vcl_deliver. >error code [reason]: means to return "code" to the client and discard processing of the request.
Vcl_miss function

The method is called automatically when the requested content is not found in the cache after the lookup instruction is executed. This function can be used to determine whether the content needs to be fetched from the back-end server.
This function usually ends with the following keywords:

>pass. >fetch: Indicates that the requested content is fetched from the backend, and the control is given to Vcl_fetch. >error code [reason]: means to return "code" to the client and discard processing of the request.
Vcl_fetch function

The method is called after the backend host updates the cache and gets the content, and then determines whether the content is cached or returned directly to the client by judging what gets.
This function usually ends with the following keywords:

>pass. >deliver: Indicates that the found content is sent to the client and gives control to Vcl_deliver. >error code [reason]: means to return "code" to the client and discard processing of the request.
vcl_deliver function

The method is called before the requested content is sent to the client in the cache.
This function usually ends with the following keywords:

>deliver: Indicates that the found content is sent to the client and gives control to Vcl_deliver. >error code [reason]: means to return "code" to the client and discard processing of the request.
vcl_timeout function

This function is called before the cached content expires.
This function usually ends with the following keywords:

>descard: Indicates that the content is clear from the cache. >fetch
Vcl_discard function

This function is called automatically after the cached content expires or when there is insufficient cache space.
This function usually ends with the following keywords:

>descard>keep: Indicates that the content continues to remain in the cache.

Free to provide the latest Linux technology tutorials Books, for open-source technology enthusiasts to do more and better: http://www.linuxprobe.com/

High performance HTTP accelerator varnish installation and configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.