Memcache redirect

Nikita Larin alaruss at gmail.com
Fri Sep 18 13:10:01 MSD 2009


Добрый день

Nginx сначала пытается найти запрос в memecached, если не находит, то
переправляет его в апач. Если в апаче сделать редирект (Location:
http://ya.ru/) то апач отдаст код ответа 302. А нгинкс при этом отдает
ошибку 404. Вот кусок конфига:

nginx 0.7.62
location / {
            default_type text/html;
            proxy_set_header    Host            $host;
            proxy_set_header    X-Real-IP       $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            if ($request_method = POST) {
                proxy_pass http://127.0.0.1:81;
                break;
            }
            set $memcached_key $uri$args;
            memcached_pass      localhost:11211;
            error_page  404 502 504 @fallback;
        }

        location @fallback {
            internal;
            root /opt/www/tv100/htdocs/;
            index  index.php index.html index.htm;
            proxy_pass http://127.0.0.1:81;
            proxy_set_header    Host            $host;
            proxy_set_header    X-Real-IP       $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        }

Спасибо.





More information about the nginx-ru mailing list