The simple topology is as follows
650) this.width=650; "title=" clipboard "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; " Border= "0" alt= "clipboard" src= "Http://img1.51cto.com/attachment/201409/25/1080241_1411662977gahg.png" height= " 483 "/>
There are 4 Web page files on the back-end server, each of which is as follows, each corresponding to the corresponding client request
Index.html
650) this.width=650; "title=" clipboard[1] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[1] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662977NhgI.png " height= "173"/>
Chrome.html
650) this.width=650; "title=" clipboard[2] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[2] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662978eT8b.png " height= "156"/>
Admroid.html
650) this.width=650; "title=" clipboard[3] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[3] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662978arqK.png " height= "148"/>
Iphone.html
650) this.width=650; "title=" clipboard[4] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[4] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662979GbdK.png " Height= "/>"
Varnish Download Area http://repo.varnish-cache.org/
The software version used here
VARNISH-3.0.5-1.EL6.X86_64.RPM provides varnish main program
VARNISH-DOCS-3.0.5-1.EL6.X86_64.RPM provides varnish documentation
VARNISH-LIBS-3.0.5-1.EL6.X86_64.RPM provides a shared library of varnish
Because of dependencies, it is best to install with Yum.
# yum Install var*.rpm
Varnish main file Description after installation of main package
# RPM-QL Varnish
/etc/logrotate.d/varnish
/etc/rc.d/init.d/varnish starting the Varnish service script
/etc/rc.d/init.d/varnishlog Varnish View Log service script
/ETC/RC.D/INIT.D/VARNISHNCSA varnish View scripts for NCSA style logs
/etc/sysconfig/varnish configuration file for varnish main program working characteristics
/etc/varnish Varnish directory for cache decisions, backend server, and other related configuration files
/ETC/VARNISH/DEFAULT.VCL Varnish Cache The default profile, using the VCL definition.
/USR/BIN/VARNISH_RELOAD_VCL implements varnish dynamic load profile tool
/USR/BIN/VARNISHADM Client Tools for connecting varnish management varnish
/var/lib/varnish where the cache is stored as a file
Edit the/etc/sysconfig/varnish file to modify the values of the following parameters
varnish_listen_port=80 Modify the port varnish_storage_size=32m settings for the client request listener to cache the size of the space as 32mvarnish_stor Age= "Malloc,${varnish_storage_size}" setting uses memory as cache media
#/ETC/VARNISH/DEFAULT.VCL Varnish's cache policy file contents are as follows
backend www1 { .host = "172.16.2.10"; .port = "80";} sub vcl_recv { if (req.url ~ "/$" && req.http.user-agent ~ "IPhone") { if the requested URL is last/and is iphone set req.url = req.url + "Iphone.html"; Add iphone.html } if after the requested URL (req.url ~ "/$" && req.http.user-agent ~ "Android") { set req.url = req.url + "android.html"; } if (req.url ~ "/$" && req.http.User-Agent ~ "Chrome") { set req.url = req.url + "chrome.html"; } return (lookup); }
After editing, start the varnish program.
# Service Varnish Start
Using each client-side test
On the Chrom.
650) this.width=650; "title=" clipboard[5] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[5] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662979a0GR.png " height= "143"/>
IE's
650) this.width=650; "title=" clipboard[6] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[6] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662979ltEz.png " height= "142"/>
Access to Safari and UC on iphone
650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; " Border= "0" alt= "image" Src= "http://img1.51cto.com/attachment/201409/25/1080241_1411662979xiLa.png" height= "573"/ >
Use 360 of browsers on Android devices
650) this.width=650; "title=" clipboard[7] "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0 px; "border=" 0 "alt=" clipboard[7] "src=" Http://img1.51cto.com/attachment/201409/25/1080241_1411662990qoX7.png " height= "389"/>
Not to be continued!!!
Varnish configuration uses chrome,iphone,android requests to respond to their respective pages