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: