Rewrite with proxy_pass

Simon Mullis simon at mullis.co.uk
Mon Nov 12 18:57:33 MSK 2007


Many thanks for the quick response Igor.

I'm sure I echo all on this list when I say thankyou for the great product!

Kind Regards

SM

On Nov 12, 2007 4:43 PM, Igor Sysoev <is at rambler-co.ru> wrote:
> On Mon, Nov 12, 2007 at 04:31:44PM +0100, Simon Mullis wrote:
>
> > I've set up monit (http://www.tildeslash.com/monit/) which by default
> > runs an http admin server on a local tcp port of your choice.
> >
> > I want to proxy requests from the outside world, via nginx, to this
> > tcp port.  I also then need to change the URI that is sent to the
> > monit web server, removing the fixed path from the URI.
> >
> > So,
> >
> > server {
> >  ....
> >          location / {
> >          ....
> >          }
> >          location /monitor/app_a {
> >          ....
> >          }
> >          location /monitor/monit {
> >               rewrite ^/monitor/monit/(.*) /$1;
> >               proxy_pass http://127.0.0.1:2812;
> >         }
> > }
> >
> > But!  It doesn't work....  It seems that I'm passing the wrong URI to monit.
> >
> > I can tell this from packet capturing on port 2812.
> >
> > What am I doing wrong?
> >
> > Cheers
>
>           location /monitor/monit {
> -              rewrite ^/monitor/monit/(.*) /$1;
> +              rewrite ^/monitor/monit/(.*) /$1   break;
>                proxy_pass http://127.0.0.1:2812;
>           }
>
> or, better:
>
>           location /monitor/monit {
> -              rewrite ^/monitor/monit/(.*) /$1;
> -              proxy_pass http://127.0.0.1:2812;
> +              proxy_pass http://127.0.0.1:2812/;
>           }
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>



-- 
Simon Mullis
_________________
simon at mullis.co.uk





More information about the nginx mailing list