ПРОЕКТЫ 


  АРХИВ 


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]

не работает error page ?


  • To: nginx-ru@xxxxxxxxx
  • Subject: не работает error page ?
  • From: "harius" <nginx-forum@xxxxxxxx>
  • Date: Tue, 27 Apr 2010 06:29:27 -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=8+pmOw8KWlbsF7Lf/S1QxfCMvbVVvgjkOoBoVkcGEWU=; b=nV56WHN1YKFn3MOIu8PvxmLIS8U36kyChx1AAR7kMQTxiM0EzscqqILGpWnoAiOIlSiHV8VKA2XsoewWVqO95EjC4Gr25DJGhQEXl5HR9Q62r5ctibd3UlE8k5Dr6JWP;

в связи с модернизацией движка сайта нужно отвечать поисковика 200 на 
запрошенную старую ссылку.
вроде все просто, смотрим в доку и пишем:

error_page   404  =200  /404;  # /404 - урл отдает спец страничку с кодом 200

интегрируем в конфиг:

limit_zone   myzone  $binary_remote_addr  10m;
proxy_cache_path /home/xxx/domains/xxx/cache/proxy levels=1:2 
keys_zone=static:250m;
proxy_cache_path /home/xxx/domains/xxxx/cache/maps/jams levels=2:2 
keys_zone=jams:250m inactive=15m;

server {
    listen xxx:80;
    server_name xxx;
    
    limit_conn   myzone  10;
    
    access_log /var/log/nginx/domains/xxx.log combined;
    
    charset utf-8;
    
    set $tile_root /home/xxx/domains/xxx/cache/maps/tiles;
    set $proxied_uri http://xxx;
    set $xmlrpc_proxied_uri http://xxx/points;
    set $editpoints_proxied_uri http://xxx/poimanager;
    
    location ~* .*\/map\/navitms.fcgi$ {
        set $fcgi_uri $uri;

        if ($args ~* 
"^t=([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}),([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}),([0-9]{2})$")
 {
            set $tile_path $1/$5/$2/$6/$3/$7/$4/$8/$9.png;
            rewrite ^.*$ /map/tiles/$tile_path last;
            }             
        if ($args ~* "^(j=[0-9]{8},[0-9]{8},[0-9]{2})(,[0-9]+)?$") {
            set $args $1;
            rewrite ^.*$ /map/jams/ last;
            }
                                                                           
        return 404;
        }
    
    location ~ (.*/img/poi/).*\.gif$ {
        root /home/xxx/domains/xxx/html;
        try_files $uri $1/1.gif =404;
        }

    location /navitel/theme/navitel {
        root /home/xxx/domains/xxx/html/map;
        }
                                    
    location /map {
        index manage.html;
        root /home/xxx/domains/xxx/html;
        }
    
    location /map/points {
        proxy_cache off;
        proxy_pass $xmlrpc_proxied_uri?$args;
        }
                                            
    location /map/poimanager {
        proxy_cache off;
        proxy_pass $editpoints_proxied_uri?$args;
        }
    
    location @proxy_tiles {
        proxy_pass        $proxied_uri$request_uri;
        proxy_store_access   user:rw  group:rw;
        proxy_store       $tile_root/$tile_path;
        }
                                                   
    location ^~ /map/tiles/ {
        internal;
        alias $tile_root/;
        if_modified_since before;
        try_files $uri @proxy_tiles;
        }
                                                                                
                                   
    location = /map/jams/ {
        internal;
        proxy_cache_valid  200 302  5m;
        proxy_cache       jams;
        proxy_pass        $proxied_uri$fcgi_uri?$args;
        }
    
    location / {
        proxy_pass http://localhost:8080;
        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;
        client_max_body_size 500m;
        # error_page   404 = /404; # все равно выдает 404 код
        }

    location ^~ /media {
        root /home/xxx/data/app/src/main/webapp;
        access_log off;
        expires 43200s;
        }

    location ^~ /media/resources {
        rewrite /media/resources/(.*)$ /$1 break;
        root /home/xxx/data/files/resources;
        access_log off;
        expires 43200s;
        }
    
    location ^~ /media/video {
        rewrite /media/video/(.*)$ /$1 break;
        mp4;
        limit_rate 200k;
        root /home/xxx/data/files/video/encoded;
        }

   location ^~ /mp4 {
        mp4;
        root /home/xxx/data/files/video;
        }
                                                
    location ^~ /media/images/uploaded {
        rewrite /media/images/uploaded/(.*)$ /$1 break;
        root /home/xxx/data/files/images/uploaded;
        access_log off;
        expires 43200s;
        }
    location ^~ /media/images/original {
        rewrite /media/images/original/(.*)$ /$1 break;
        root /home/xxx/data/files/images/original;
        access_log off;
        expires 43200s;
        }

    location ^~ /internal/attachment {
        mp4;
        rewrite /internal/attachment/(.*)$ /$1 break;
        root /home/xxx/data/files/attachment;
        access_log off;
        expires 43200s;
        }

    error_page   404 = /404; # все равно выдает 404 код
    error_page 501 502 503 504 505 /media/html/; # хотя 503 ошибку отрабатывает 
}

Че забыл, что пропустил, куда копать?

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,79844,79844#msg-79844


_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.