Varnish enables page Jump

Source: Internet
Author: User
Tags varnish

Varnish enables page Jump

Ngxin implements user-agent to access non-page pages. It is very simple, but we generally use the cache layer as the front end. The same principle applies to the cache layer.

We use Varnish today. Note that we implement 302 redirect instead of rewrite url.

Target: the iphone automatically jumps to m.bkjia.com to access www.bkjia.com.

Post Code

Sub vcl_recv {
 
If (req. http. user-agent ~ "Iphone "){
If (req. http. host ~ "Www.bkjia.com "){
Error 750 "m.bkjia.com ";
}
}
}
 
Sub vcl_error {
If (obj. status = 750 ){
If (obj. response ~ "M.bkjia.com "){
Set obj. http. Location = "http://m.bkjia.com /";
}
Set obj. status = 302;
Return (deliver );
}
}

Concepts of Cache Server Varnish

Concepts of Cache Server Varnish

Structural notes for Varnish Cache

Install and configure Varnish-5.8 in CentOS 2.1.5

The RedHat script uses the CentOS source to update and install Nginx, PHP 5.3, and Varnish.

Using Varnish to build Cache Server notes

Install and configure the cache service Varnish

Preparations for Varnish compilation and Installation

Configuration Optimization of Varnish cache in Linux

Varnish details: click here
Varnish: click here

This article permanently updates the link address:

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.