Help trying to understand a rewrite rule

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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs