question about proxy_store

Igor Sysoev is at rambler-co.ru
Mon Jan 28 09:21:27 MSK 2008


On Sat, Jan 26, 2008 at 07:18:26PM -0800, eliott wrote:

> I am having problems with proxy being unable to store pages that do
> not have a file extension (such as a directory or "nice url").
> 
> 1. User requests http://domain.com/page/hello/
> 2. nginx looks in the root, can not find the page.
> 3. nginx uses the error page, which then calls a proxy pass inside a location
> 4. nginx fetches the page.
> 5. nginx cannot save the results, because it is /page/hello/
>    nginx does create the /page/hello/ directory inside the proxy_store
> directory though.
> 
> ####
> 
> It could very well be a problem with my configuration. It works for
> urls with file extensions.
> 
>         location ^~ /fetch/ {
>             internal;
>             include  proxy.conf;
>             proxy_set_header  X-Real-IP $remote_addr;
>             proxy_pass http://127.0.0.1:9001/;
>             proxy_store /var/www/data/domain.com$uri;
>             proxy_store_access user:rw group:rw all:r;
>         }
> 
>         location / {
>             root /var/www/data/doman.com/fetch;
>             error_page 404 = /fetch$uri;
>         }

You may try

          location / {
              root /var/www/data/doman.com/fetch;
              set     $fetch   /fetch$uri;
              error_page 404 = $fetch;
          }

          location ~ /$ {
              index   index.html;
              root /var/www/data/doman.com/fetch;
              set     $fetch   /fetch${uri}index.html;
              error_page 403 404 = $fetch;
          }

          location ^~ /fetch/ {
              internal;
              include  proxy.conf;
              proxy_set_header  X-Real-IP $remote_addr;
              proxy_pass http://127.0.0.1:9001/;
              proxy_store /var/www/data/domain.com$fetch;
              proxy_store_access user:rw group:rw all:r;
          }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list