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

-=HaRius=- rh на nobrend.ru
Вт Апр 27 17:09:45 MSD 2010


27 апреля 2010 г. 16:56 пользователь Sergey Shepelev <temotor at gmail.com>написал:

> 2010/4/27 -=HaRius=- <rh at nobrend.ru>:
> > хм...
> >
> > server {
> > ...
> > location / {
> > ...
> > proxy_intercept_errors off; # явно, если on - 404 явная nginx'а страница
> > error_page 404 =200 /404; # firebug все равно показывает 404
> > ...
> > }
> > }
> >
>
> У вас нет location = /404.
>
> То есть вы хотите, чтобы при 404 от бекенда, nginx лез опять к бекенду
> с урлом /404 и вернул ответ как 200 ОК?
>
> То есть ту страницу, которую бекенд первый раз отдаёт с кодом 404 вы
> хотите просто проигнорировать? Не проще ли сразу вернуть там нужный
> контент?
>
> > 27 апреля 2010 г. 15:49 пользователь Igor Sysoev <igor at sysoev.ru>
> написал:
> >>
> >> On Tue, Apr 27, 2010 at 06:29:27AM -0400, harius wrote:
> >>
> >> > в связи с модернизацией движка сайта нужно отвечать поисковика 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 код
> >>
> >>
> >>
> http://sysoev.ru/nginx/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors
> >>
> >>
> >> --
> >> Игорь Сысоев
> >> http://sysoev.ru
> >>
> >> _______________________________________________
> >> nginx-ru mailing list
> >> nginx-ru at nginx.org
> >> http://nginx.org/mailman/listinfo/nginx-ru
> >
> >
> > _______________________________________________
> > nginx-ru mailing list
> > nginx-ru at nginx.org
> > http://nginx.org/mailman/listinfo/nginx-ru
> >
> >
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20100427/1a92282a/attachment.html>


Подробная информация о списке рассылки nginx-ru