ПРОЕКТЫ 


  АРХИВ 


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]

Кэширование в nginx


  • To: nginx-ru@xxxxxxxxx
  • Subject: Кэширование в nginx
  • From: "ower" <nginx-forum@xxxxxxxx>
  • Date: Tue, 18 May 2010 02:44:42 -0400
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mickey.jlkhosting.com; s=x; h=Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To:Date; bh=udS97cdnCAHsrRobMK9WWc0kd9xfwIoopD6kKXJMHa0=; b=jgML7Ml4W4re8eYR79gDc51640sfJY1pDt2WS6PzhdWbXSiJ1GaOnf8KjWZcqbg0F/bIoyedJR8oumRw/5qqPGE5syhnyWwEKZQ2dckYd6Jb0sIG6Z6iibeApnrg14At;

Здравствуйте.

Попробовал сделать вот такой конфиг для 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@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.