国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Varnish 緩存服務(wù)器配置
Arnish是一款高性能的開源HTTP加速器,挪威最大的在線報(bào)紙 Verdens Gang ([url]http://www.vg.no[/url]) 使用3臺(tái)Varnish代替了原來的12臺(tái)squid。 
性能比以前更好。 
varnish的作者Poul-Henning Kamp是FreeBSD的內(nèi)核開發(fā)者之一,他認(rèn)為現(xiàn)在的計(jì)算機(jī)比起1975年已經(jīng)復(fù)雜許多。在1975年時(shí),儲(chǔ)存媒介只有兩 
種:內(nèi)存與硬盤。但現(xiàn)在計(jì)算機(jī)系統(tǒng)的內(nèi)存除了主存外,還包括了cpu內(nèi)的L1、L2,甚至有L3快取。硬盤上也有自己的快取裝置,因此squid 
cache自行處理物件替換的架構(gòu)不可能得知這些情況而做到最佳化,但操作系統(tǒng)可以得知這些情況,所以這部份的工作應(yīng)該交給操作系統(tǒng)處理, 
這就是 Varnish cache設(shè)計(jì)架構(gòu)。 
1.下載源碼包編譯安裝: 
cd /usr/local/src && wget [url]http://nchc.dl.sourceforge.net/s ... arnish-1.1.1.tar.gz [/url]
tar zxvf /usr/local/src/varnish-1.1.1.tar.gz 
cd /usr/local/src/varnish-1.1.1 
./autogen.sh 
./configure --enable-debugging-symbols --enable-developer-warnings --enable-dependency-tracking 
注:如果你的gcc版本是4.2.0或更高的版本,可以加上--enable-extra-warnings編譯參數(shù),在出錯(cuò)時(shí),得到附加的警告信息。 
我這里是用源碼包安裝的,如果你是redhat或centos可以用rpm包來安裝(rpm下載位置:
http: //sourceforge.net/project/showfiles.php?group_id=155816&package_id=173643&release_id=533569). 
2. 建立cache目錄: 
mkdir -p /cache/varnish/V && chown -R nobody:nobody /cache 
3.編寫啟動(dòng)文件: 
cd /usr/local/varnish/sbin 
vi start.sh 
內(nèi)容如下: 
#!/bin/sh 
# file: go.sh 
date -u 
/usr/local/varnish/sbin/varnishd \ 
-a 10.0.0.129:80 \ 
-s file,/cache/varnish/V,1024m \ 
-f /usr/local/varnish/sbin/vg.vcl.default \ 
-p thread_pool_max=1500 \ 
-p thread_pools=5 \ 
-p listen_depth=512 \ 
-p client_http11=on \ 
注:-a 是指定后端服務(wù)器的ip或hostname,就象squid做revese proxy時(shí)的originserver. 
不過這個(gè)也可以在vcl里面寫。 
-f 是指定所用的vcl的文件。 
-s 指定cache目錄的存儲(chǔ)類型,文件位置和大小。 
-p 是指定varnish的啟動(dòng)的一些啟動(dòng)參數(shù),可以根據(jù)自己的機(jī)器配置來優(yōu)化varnish的性能。 
其他參數(shù)已經(jīng)參數(shù)的具體含義可以用varnishd --help 來查看。 
4.編寫vcl: 
我的vcl如下: 
backend default { 
set backend.host = "127.0.0.1"; 
set backend.port = "http"; 
#我用的是一臺(tái)機(jī)器做測(cè)試,使用的backend用的是127.0.0.1:80.如果varnish機(jī)器和后臺(tái)的機(jī)器分開的。 
寫上對(duì)應(yīng)的機(jī)器的ip或hostname就可以了。 
sub vcl_recv { 
if (req.request != "GET" && req.request != "HEAD") { 
pipe; 
if (req.http.Expect) { 
pipe; 
if (req.http.Authenticate || req.http.Cookie) { 
pass; 
if (req.request == "GET" && req.url ~ "\.(gif|jpg|swf|css|js)$") { 
lookup; 
lookup; 
sub vcl_pipe { 
pipe; 
sub vcl_pass { 
pass; 
sub vcl_hash { 
hash; 
sub vcl_hit { 
if (!obj.cacheable) { 
pass; 
deliver; 
sub vcl_timeout { 
discard; 
sub vcl_discard { 
discard; 
如果是多個(gè)站點(diǎn)在不同的originserver時(shí),可以使用下面配置: 
backend www { 
set backend.host = "www.jackbillow.com"; 
set backend.port = "80"; 
backend images { 
set backend.host = "images.jackbillow.com"; 
set backend.port = "80"; 
sub vcl_recv { 
if (req.http.host ~ "^(www.)?jackbillow.com$") { 
set req.http.host = "www.jackbillow.com"; 
set req.backend = www; 
} elsif (req.http.host ~ "^images.jackbillow.com$") { 
set req.backend = images; 
} else { 
error 404 "Unknown virtual host"; 
5.啟動(dòng)varnish: 
/usr/local/varnish/sbin/start.sh 
Mon Sep 3 03:13:19 UTC 2007 
file /cache/varnish/V/varnish.tEKXXx (unlinked) size 1073741824 bytes (262144 fs-blocks, 262144 pages) 
Using old SHMFILE 
ps waux | grep varnish 
root 16254 0.0 0.0 11200 708 ? Ss 10:43 0:00 /usr/local/varnish/sbin/varnishd -a 10.0.0.129:80 -s /varnish/V,1024m 
-f /usr/local/varnish/sbin/vg.vcl.default -p thread_pool_max 1500 -p thread_pools 5 -p listen_depth 512 -p client_http11 on 
nobody 16255 0.0 0.1 1152552 1808 ? Sl 10:43 0:00 /usr/local/varnish/sbin/varnishd -a 10.0.0.129:80 -s 
file,/cache/varnish/V,1024m -f /usr/local/varnish/sbin/vg.vcl.default -p thread_pool_max 1500 -p thread_pools 5 -p 
listen_depth 512 -p client_http11 on 
看到上面信息說明varnish正確啟動(dòng),恭喜你,你已經(jīng)配置成功了
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
用Varnish搭建Cache服務(wù)器
使用Varnish代替Squid做網(wǎng)站緩存加速器的詳細(xì)解決方案
Varnish
CentOS 5.5環(huán)境下安裝配置Varnish
Varnish-高效的HTTPaccelerator
Linux服務(wù)篇--varnish緩存
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服