Help trying to understand a rewrite rule

Guido gaccardo at gmail.com
Tue Dec 29 16:28:42 UTC 2015


Hi everyone,

   I have 2 graphites running with uWSGI in two separated servers, both
listening in the port 3031. In a third server I also have an nginx
installed . In that nginx, I've this configuration:

upstream graphite {
        server 10.0.2.22:3031;
}
upstream graphite2 {
        server 10.0.2.21:3031;
}

server {
        listen 80;

        location / {
                include uwsgi_params;
                uwsgi_pass graphite;
        }

        location /graphite02 {
                rewrite /graphite02/(.+) /$1 break;
                include uwsgi_params;
                uwsgi_pass      graphite2;
        }
}

My intention is:

* Every request http://nginx_ip/ goes to the first graphite
* Every request http://nginx_ip/graphite02/ goes to the second one BUT as /
not /graphite02

My configuration doesn't do what I need, instead every request
http://nginx_ip/graphite02/ goes to the FIRST graphite as /

Also, I've tried modifying this:

...
        location /graphite02 {
                uwsgo_param PATH_INFO /;
                include uwsgi_params;
                uwsgi_pass      graphite2;
        }
...

With no success. Can you help me to understand where is my problem? Perhaps
I misunderstood completely the way that rewrites works.

Thanks!

-- 
-- Guido Accardo --
"... What we know is a drop, what we ignore is the ocean ..." Isaac Newton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151229/cedb4325/attachment.html>


More information about the nginx mailing list