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 код