Welcome! Log In Create A New Profile

Advanced

Re: Подскажите как лучше сделать try_files + proxy_cache

Maxim Dounin
December 08, 2014 12:16PM
Hello!

On Mon, Dec 08, 2014 at 08:58:30PM +0400, kpoxa wrote:

> Добрый день.
>
>
>
> Надо сделать 2 кеша на 2 дисках для 2 разных локейшенов, но с try_files
> локальных файлов.
>
>
> Вариант
>
> server {
> server_name server80;
> listen 80;
> root /etc/nginx/html;
> try_files $uri @local;
> location @local {
> internal;
> proxy_pass http://localhost80:800;
> }
> }
> server {
> server_name local800;
> listen 127.0.0.1:800;
> location /1/ {
> proxy_cache1;
> proxy_pass http://server1;
> }
> location /2/ {
> proxy_cache2;
> proxy_pass http://server2;
> }
> }
>
> Гоняет трафик через лупбэк почем зря.
> А в @локейшен вложенные локейшены делать нельзя.

А что мешает сделать так:

location /1/ {
try_files $uri @cache1;
}

location @cache1 {
proxy_pass http://server1;
proxy_cache cache1;
}

location /2/ {
try_files $uri @cache2;
}

location @cache2 {
proxy_pass http://server2;
proxy_cache cache2;
}

?

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Подскажите как лучше сделать try_files + proxy_cache

kpoxa December 08, 2014 12:00PM

Re: Подскажите как лучше сделать try_files + proxy_cache

Maxim Dounin December 08, 2014 12:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready