Администрирование серверов

Установка Varnish как frontend Apache

by zippo on Окт.25, 2010, в разделе Администрирование

Преследуется такая же идея, как и в случае Nginx – кэширование статики =).
Эксперимент проводился в Debian Lenny.
Для установки varnish подключаем его репу


wget http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -

добавляем в /etc/apt/sources.list


deb http://repo.varnish-cache.org/debian/ lenny varnish-2.1
apt-get update
apt-get install varnish

поправим /etc/default/varnish
в «DAEMON_OPTS» изменим *:6081 на *:80

и /etc/varnish/default.vcl

backend apache {
.host = "127.0.0.1";
.port = "8000";
}

sub vcl_fetch {
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = req.http.rlnclientipaddr;
return(deliver);
}

sub vcl_deliver {
remove resp.http.X-Varnish;
remove resp.http.Via;
remove resp.http.Age;
remove resp.http.X-Powered-By;
}

Нам осталось поправить конфиг apache и установить mod_rpaf

Открываем /etc/apache2/sites-enabled/default и меняем

NameVirtualHost *:80
Listen 80

на

NameVirtualHost *:8080
Listen 127.0.0.1:8080

ну и все на

сохраняем и закрываем конфиг.

Ставим mod_rpaf
apt-get install libapache2-mod-rpaf

Рестарт apache & varnish и полетели =)

/etc/init.d/apache2 restart
/etc/init.d/varnish restart

google.com bobrdobr.ru del.icio.us technorati.com linkstore.ru news2.ru rumarkz.ru memori.ru moemesto.ru
:,

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...