Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install HTTP Accelerator Varnish under Linux

2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to install HTTP Accelerator Varnish under Linux". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to install HTTP Accelerator Varnish under Linux" can help you solve the problem.

Varnish is a high-performance and open source reverse proxy server and HTTP accelerator. It adopts a new software architecture and works closely with the current hardware system. Compared with the traditional squid, varnish has many advantages, such as higher performance, faster speed, more convenient management and so on.

Installation

Install pcre

If pcre is not installed, when compiling varnish 2.0 or later, you will be prompted that the pcre library cannot be found, and the pcre library is for compatibility with regular expressions, so you must install the pcrelibrary first. Here is the installation process for pcre:

[root@varnish-server] # tar-zxvf pcre-7.9.tar.gz [root@varnish-server ~] # cd pcre-7.9/ [root@varnish-server ~] #. / config-- prefix=/usr/local/pcre/ [root@varnish-server ~] # make & & make install

Install Varnish

Here, install Varnish into the / usr/local/ directory as follows:

[root@varnish-server ~] # tar-zxvf varnish-2.1.2.tar.gz [root@varnish-server ~] # cd varnish-2.1.2 [root@varnish-server ~] # export PKG_CONFIG_PATH=/usr/local/pcre/lib/ PKgconfig[ root @ varnish-server ~] #. / configuer-- prefix=/usr/local/varnish\ >-- enable-dependency-tracking >-- enable-debugging-symbols >-- enable-developer-warnings [root@varnish-server ~] # Make [root@varnish-server ~] # make install [root@varnish-server ~] # cp redhat/varnish.initrc / etc/init.d/varnish [root@varnish-server ~] # cp redhat/varnish.sysconfig / etc/syscinfug/varnish

Where "PKG_CONFIG_PATH" is the path where Varnish is specified to find the pcre library, and at this point, Varnish is installed.

Configuration

Due to space constraints, here is to introduce the meaning of VCL built-in functions, please forgive me!

Vcl_recv function

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

> pass: enter pass mode and hand over the control of the request to the vcl_pass function. > pipe: it means to enter pipe mode. Please transfer the control of the request to the vcl_pipe function. > error code [reason]: returns "code" to the client and abandons processing of the request.

Vcl_pipe function

This function is called when entering pipe mode and is used to pass the request directly to the backend host and return the same content to the client without changing the request and return content until the connection is closed. This function generally ends with the following keywords:

> pipe: it means to enter pipe mode. Please transfer the control of the request to the vcl_pipe function. > error code [reason]: returns "code" to the client and abandons processing of the request.

Vcl_pass function

This function is called when entering pass mode and is used to pass the request directly to the back-end host. After replying to the data, the back-end host sends the reply data to the client without any caching and returns the latest content each time under the current connection. This function generally ends with the following keywords:

> pass. > error code [reason]: returns "code" to the client and abandons processing of the request. Lookup

It means to look up the requested object in the cache and give control to vcl_hit or the function vcl_miss according to the result of the search.

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 generally ends with the following keywords:

> pass: enter pass mode and hand over the control of the request to the vcl_pass function. > deliver: sends the found content to the client, and gives control to vcl_deliver. > error code [reason]: returns "code" to the client and abandons processing of the request.

Vcl_miss function

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

> pass. > fetch: it means to obtain the content of the request from the backend and give control to vcl_fetch. > error code [reason]: returns "code" to the client and abandons processing of the request.

Vcl_fetch function

The method is called after the back-end host updates the cache and acquires the content, and then determines whether to put the content in the cache or return it directly to the client by judging the acquired content. This function generally ends with the following keywords:

> pass. > deliver: sends the found content to the client, and gives control to vcl_deliver. > error code [reason]: returns "code" to the client and abandons processing of the request.

Vcl_deliver function

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

> deliver: sends the found content to the client, and gives control to vcl_deliver. > error code [reason]: returns "code" to the client and abandons processing of the request.

Vcl_timeout function

This function is called before the cache content expires. This function generally 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 cache content expires or when the cache space is insufficient. This function generally ends with the following keywords:

> descard > keep: it means to keep the content in the cache. This is the end of the introduction on "how to install HTTP Accelerator Varnish under Linux". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report