ðòïåëôù 


  áòèé÷ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  óôáôøé 


  ðåòóïîáìøîïå 


  ðòïçòáííù 



ðéûéôå
ðéóøíá












     áòèé÷ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memcached_pass, proxy_pass, error_page


  • To: nginx-ru@xxxxxxxxx
  • Subject: memcached_pass, proxy_pass, error_page
  • From: ëÏÓÔÅÎËÏ å×ÇÅÎÉÊ <nobody.mail@xxxxxxxxx>
  • Date: Wed, 16 Sep 2009 17:49:18 +0400
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=+qrJdFT9FsDO2BgV9yhAahdP8G6wTrjUFH1/qGHmhaI=; b=JYWnTHEqzB9w2UVkea7VjhoqkfwulFMR2G3LZdJT90FeZfbQZqqGVlBzuRGzX/PTeX PAoDXIXKroxWI+cqMLrTceYBOuaKYxd7RLhaq0pN0+CJwqVzhAgCy8K8so8baSjmJbqV qc0ndF+GLTB+mNDa3vrkbR6HNafo/vm2RwNEY=
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=ubeRsvdE/xQOdy81gZ1xu5rCQ/o3ltsVrdSW+J86jr6EsQN/RvI+s0tNNdiGDdzf8+ JG59hASrNn7wrFo/Gpen3d8nfhi86E5sS+Xxcd+LBZuFZBC7PiqdoKBd5M9cX3QmzDsF bENhng2uSwsMJ7dNstTr0f6um5QeIiRL665dE=

äÏÂÒÙÊ ÄÅÎØ.

óÈÅÍÁ ÓÌÅÄÕÀÝÁÑ ÅÓÔØ frontend É Ä×Á backend'Á. ðÏÐÙÔËÁ c ÐÏÍÏÝØÀ 0.7.62 ÉÚÏÂÒÁÚÉÔØ ÓÌÅÄÕÀÝÅÅ:

# ÎÁ ÕÒÏ×ÎÅ http ÄÅËÌÁÒÉÒÏ×ÁÎ upstream, ÉÓÐÏÌØÚÕÅÍÙÊ ÄÁÌÅÅ

ššš upstreamš backendsš {
ššššššš serveršš server1.domain.tld weight=4;
ššššššš serveršš server2.domain.tld weight=4;
ššššššš #serveršš 127.0.0.1 weight=2;
ššš }

# íÅÌËÉÅ ÆÁÊÌÙ ÐÙÔÁÅÍÓÑ ÎÁÊÔÉ × memcached. îÅ ÎÁÛÌÉ - ÐÏ error_page 404 ÉÄÅ× × @try_backends .

šššššš location ~* ^.+\.(css|js|ico|gif|png|jpeg|jpg)$ {
ššššššššššš set $memcached_key "$host$uri";
ššššššššššš memcached_passšššš memcached;

ššššššššššš error_page 404š =š @try_backends;
ššššššš }

# ÷ location ÐÒÏÐÉÓÁÎ upstream backends, ÓÏÓÔÏÑÝÉÊ ÉÚ ÔÅÈ ÓÁÍÙÈ ÂÜËÅÎÄÏ×.

ššššš location @try_backends {
ššššššššššš proxy_passš http://backends;
ššššššššššš proxy_redirectšššš off;
ššššššššššš proxy_set_headeršš Hostšššššššššššš $host;
ššššššššššš proxy_set_headeršš X-Real-IPššššššš $remote_addr;
ššššššššššš proxy_set_headeršš X-Forwarded-Forš $proxy_add_x_forwarded_for;
ššššššššššš proxy_next_upstreamš http_404;
ššššššššššš proxy_intercept_errors on;

ššššššššššš if ($uri ~* \.(css|js|ico)$) { expires 1d; }
ššššššššššš if ($uri ~* \.(jpg|jpeg|gif|png|ico)$) { expires 1d; }
ššššššššššš error_page 404š =š @fallback;

ššššššššššš access_logššššššššš off;
ššššššš }

# åÓÌÉ É ÔÕÔ error_page 404 - ÉÄÅÍ × @fallback, ÇÄÅ ÓÏÂÓÔ×ÅÎÎÏ root /some/path/

šššššš location @fallback {
ššššššššššš if ($uri ~* \.(css|js|ico)$) { expires 1d; }
ššššššššššš if ($uri ~* \.(jpg|jpeg|gif|png|ico)$) { expires 1d; }

ššššššššššš rootššššššš $root_path;
ššššššššššš access_logššššššššš off;
ššššššš }

#÷ÓÅ ÓÉÅ ÓÞÁÔØÅ ÉÎËÌÀÄÉÔÓÑ × ËÁÖÄÙÊ vhost ÓÌÅÄÕÀÝÉÍ ÏÂÒÁÚÏÍ

šš server {
ššššššš listenšššššš xx.xx.xx.xx:80;
ššššššš server_nameš www.domain.tld domain.tld;

ššššššš access_log /var/log/nginx/domain.tld.access.logš main buffer=1m;

ššššššš set $root_pathšš /some/path/vhosts/domain.tld/public_html;
ššššššš includeššššššš /usr/local/etc/nginx/common/*.conf;
ššš }

æÏËÕÓ ÎÅ ÕÄÁÅÔÓÑ - memcached É backend'Ù ÐÒÏ×ÅÒÑÀÔÓÑ, ÄÏ fallback ÄÅÌÏ ÎÅ ÄÏÈÏÄÉÔ.
ðÏÌÉÓÔÁÌ ÁÒÈÉ× ÒÁÓÓÙÌËÉ, ÐÏÒÙÌÓÑ × ÇÕÇÌÅ - ÏÔ×ÅÔÁ ÎÅ ÎÁÛÅÌ.

ðÏÄÓËÁÖÉÔÅ ÐÏÖÁÌÕÊÓÔÁ, ÇÄÅ Ñ ÐÒÏÍÁÈÎÕÌÓÑ?

--
ó õ×ÁÖÅÎÉÅÍ,
ëÏÓÔÅÎËÏ å×ÇÅÎÉÊ

ÍÏÂ: +7(928)2961142
icq: 101241013
jabber: nobody.mail@xxxxxxxxx



 




Copyright © Lexa Software, 1996-2009.