Upstream fail over?
Mitchua Mitchua
lists at ruby-forum.com
Sun Jul 26 18:42:55 MSD 2009
merlin corey wrote:
> Hello,
>
> Yes, very easily with 0.7.x and above. It would be something like
> below ( check http://wiki.nginx.org/NginxHttpCoreModule#try_files )
>
> location / {
> try_files @varnish @application;
> }
>
> location @varnish {
> // proxy to varnish
> }
>
> location @application {
> // proxy to application
> }
>
> -- Merlin
I tried a config like this on 0.8.6 and I found that all requests ended
up going to the @application proxy, skipping the @varnish proxy
entirely. Am I doing something wrong?
Here's a sample of my config:
upstream varnishservers
{
server 10.1.1.1:80;
}
upstream originservers
{
server 10.1.1.2:80;
server 10.1.1.2:80;
}
server
{
listen 8080;
server_name _;
server_name_in_redirect off;
location /
{
try_files @vanish @origin;
}
location @varnish
{
proxy_pass http://varnishservers;
proxy_set_header Host $host;
proxy_connect_timeout 3;
proxy_next_upstream error timeout;
}
location @origin
{
proxy_pass http://originservers;
proxy_set_header Host $host;
proxy_connect_timeout 3;
proxy_next_upstream error timeout;
}
}
Thanks!
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list