Welcome! Log In Create A New Profile

Advanced

Re: proxy_pass to multi background monit http services

March 24, 2009 02:19AM
On Mon, Mar 23, 2009 at 10:39:13PM +0100, Chris Kraybill wrote:

> Seven Du wrote:
> > monit has an embedded web interface, I want to use nginx to proxy
> > several servers:
> >
> > http://monit.example.com/server1
> > http://monit.example.com/server2
> > http://monit.example.com/server3
> > http://monit.example.com/server4
> >
> >
> > location /server1/ {
> > rewrite ^/sever1/(.*) /$1 break;
> > proxy_pass http://localhost:2812; #monit default port
> > }
> > location /server2/ {.....}
> >
> > The first page of each monit server displays well but because all links
> > in monit has absolute path http://monit.example.com/some_link instead of
> > http://monit.example.com/server1/some_link, I don't know hot to make
> > that work.
> >
> >
>
> Had the same problem. I was running monit 4.8 and running into the same
> issues. You need monit 4.9 or later to handle reverse proxying. This
> post helped me get monit 4.10 installed without re-compiling from
> source: http://route19.com/logbook/view/monit-410-on-ubuntu-804.
>
> > Can nginx do that? or we need to modify monit?
>
> So the answer is yes, nginx can do this with the proper version of
> monit. Here's the relevant nginx set-up that worked for me:
>
> location /monit/ {
> auth_basic "Restricted";
> auth_basic_user_file /etc/nginx/auth.passwd;
> rewrite ^/monit/(.*) /$1 break;
> proxy_pass http://127.0.0.1:2812/;
> }

You do not need rewrite here - proxy_pass rewrite /monit/* to /* by itself:

location /monit/ {
...
- rewrite ^/monit/(.*) /$1 break;
proxy_pass http://127.0.0.1:2812/;


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Re: proxy_pass to multi background monit http services

Chris Kraybill March 23, 2009 06:02PM

Re: proxy_pass to multi background monit http services

Igor Sysoev March 24, 2009 02:19AM

Re: proxy_pass to multi background monit http services

Rush June 25, 2009 05:45PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 321
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