Re: ëÜÛÉÒÏ×ÁÎÉÅ × nginx
Yuriy Taraday
yorik.sar ÎÁ gmail.com
÷Ô íÁÊ 18 10:53:01 MSD 2010
ëÁË ÓÌÅÄÕÅÔ ÉÚ ÔÅËÓÔÁ ÏÛÉÂËÉ, ÎÅÔ location @nocached, ÎÁ ËÏÔÏÒÕÀ
ÓÓÙÌÁÅÔÅÓØ × ÓÔÒÏÞËÅ "error_page 412 = @nocached;".
2010/5/18 ower <nginx-forum at nginx.us>:
> úÄÒÁ×ÓÔ×ÕÊÔÅ.
>
> ðÏÐÒÏÂÏ×ÁÌ ÓÄÅÌÁÔØ ×ÏÔ ÔÁËÏÊ ËÏÎÆÉÇ ÄÌÑ nginx ÎÁ Ó×ÏÅÍ VPS, ÎÏ ÐÒÉ ÚÁÐÕÓËÅ ÎÁ ÎÅÍ ×ÙÓËÁËÉ×ÁÅÔ ÏÛÉÂËÁ 504 nginx. ÷ ÌÏÇÅ nginx ÏÛÉÂËÉ ÔÁËÏÇÏ ÒÏÄÁ:
>
> 2010/05/18 09:41:12 [error] 15597#0: *39 could not find named location "@nocached", client: 94.246.127.88, server: example.com, request: "GET / HTTP/1.1", host: "example.com"
> 2010/05/18 09:41:22 [error] 15597#0: *49 could not find named location "@nocached", client: 195.93.155.18, server: example.com, request: "GET / HTTP/1.1", host: "example.com"
>
> É ÔÁË ÄÁÌÅÅ.... îÁ ×ÓÅ ÐÁÐËÉ /var/cache/nginx/ É ×ÎÕÔÒÉ ÎÅÅ ÐÒÁ×Á nginx ×ÙÓÔÁ×ÌÅÎÙ - 700. ðÏÄÓËÁÖÉÔÅ, ÞÔÏ ÎÅ ÔÁË, ÎÅ ÍÏÇÕ ÐÏÎÑÔØ...
>
> š š š šhttp {
>
> š šproxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=one:16m inactive=7d max_size=1024m;
> š šproxy_temp_path /var/cache/nginx/temp;
>
> š š š šserver {
> š š š š š š š šset $cached 0;
> š š š š š š š šlisten backend:80;
> š š š š š š š šserver_name example.com www.example.com;
> š š š š š š š šrewrite ^(/manager/.*)$ https://$host$1 permanent;
> š š š š š š š šproxy_temp_path /var/cache/nginx/example.com;
>
> š š š š š š š šlocation ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
> š š š š š š š š š š š šproxy_pass http://backend:8080;
> š š š š š š š š š š š šproxy_redirect off;
> š š š š š š š š š š š šproxy_set_header Host $host;
> š š š š š š š š š š š šproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> š š š š š š š š š š š šproxy_set_header X-Real-IP $remote_addr;
> š š š š š š š š}
> š š š š š š š šlocation / {
> š š š š š š š š š š š šproxy_pass http://backend:8080;
> š š š š š š š š š š š šproxy_redirect off;
> š š š š š š š š š š š šproxy_set_header Host $host;
> š š š š š š š š š š š šproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> š š š š š š š š š š š šproxy_set_header X-Real-IP $remote_addr;
> š š š š š š#ÚÄÅÓØ ÍÙ ÆÉÌØÔÒÕÅÍ ÎÁÛÉÈ ÚÁÌÏÇÉÎÅÎÙÈ ÐÏÌØÚÏ×ÁÔÅÌÅÊ
> š š š š š šif ($cookie_dle_user_id) { return 412; }
> š š š š š šif ($cookie_dle_password) { return 412; }
> š š š š š šif ($request_method = POST ) {
> š š š š š šreturn 412;
> š š š š}
> š š š š š šerror_page 412 = @nocached;
> š š š š š šproxy_cache one;
> š š š š š šproxy_cache_key "$request_method|$is_args|$host|$request_uri";
> š š š š š šproxy_hide_header "Set-Cookie";
> š š š š š šproxy_ignore_headers "Cache-Control" "Expires";
> š š š š š šproxy_cache_valid 200 302 304 5m;
> š š š š š šproxy_cache_valid 301 1h;
> š š š š š šproxy_cache_valid 503 4s;
> š š š š š šproxy_cache_valid any 1m;
> š š š š š šproxy_cache_use_stale http_502 http_503 http_504;
> š š š š š š š š}
> š š š šlocation ~ (sumiks.php|admin.php|index.php?action=logout) {
> š š š š š šproxy_pass http://backend:8080;
> š š š š š šproxy_redirect off;
> š š š š š šproxy_set_header Host $host;
> š š š š š šproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> š š š š š šproxy_set_header X-Real-IP $remote_addr;
> š š š š}
> š š š š š š š šlocation ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
> š š š š š š š š š š š šroot /var/www/example/data/www/example.com;
> š š š š š šexpires 1y;
> š š š š š š š š š š š šaccess_log /var/www/httpd-logs/example.com.access.log;
> š š š š š š š š š š š šerror_page 404 = @fallback;
> š š š š š švalid_referers š none šblocked šserver_names
> š š š š š š~\.google\.
> š š š š š š~\.yandex\.
> š š š š š š~\.images.yandex\.
> š š š š š š~\.yahoo\.
> š š š š š š~\.marketgid\.
> š š š š š š~\.msn\.
> š š š š š š~\.altavista\.
> š š š š š š~\.rambler\.
> š š š š š š~\.mail\.
> š š š š š š~\.gogo\.
> š š š š š š~\.aport\.
> š š š š š š~\.bing\.
> š š š š š š~\.poisk\.
> š š š š š š~\.conduit\.
> š š š š š š~\.nigma\.
> š š š š š š~\.icq\.
> š š š š š š~\.qip\.
> š š š š š š~\.liveinternet\.
> š š š š š š~\.tut\.
> š š š š š š~\.rss2email.ru\.
> š š š š š š~\.rsslenta.ru\. ;
> š š š š š šif ($invalid_referer) {
> š š š š š šreturn š 403;
> š š š š š š š š}
> š š š š š š š š}
> š š š š š š š šlocation @fallback {
> š š š š š š š š š š š šproxy_pass http://backend:8080;
> š š š š š š š š š š š šproxy_set_header Host $host;
> š š š š š š š š š š š šproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> š š š š š š š š š š š šproxy_set_header X-Real-IP $remote_addr;
> š š š š š š š š}
> š š š š}
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?21,87654,87654#msg-87654
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
ðÏÄÒÏÂÎÁÑ ÉÎÆÏÒÍÁÃÉÑ Ï ÓÐÉÓËÅ ÒÁÓÓÙÌËÉ nginx-ru