Welcome! Log In Create A New Profile

Advanced

Re: monit rewrite

September 27, 2012 03:40AM
On Thu, Sep 27, 2012 at 12:02:35AM +0200, António P. P. Almeida wrote:
> On 26 Set 2012 23h56 CEST, appa@perusio.net wrote:
>
> > On 26 Set 2012 21h00 CEST, aweber@comcast.net wrote:
> >
> >> OK, I am positive this is easy for you experienced nginx users!
> >>
> >> I have a backend app server setup and am using nginx for
> >> caching/proxy/ssl-termination.
> >>
> >> I would like to use the "default" server (listening on 443) to
> >> redirect the url https://host/monit to the server's monit-mini-http
> >> server (and continue to use it for ssl termination). so I need to
> >> direct the backend to http://localhost:2812/.
> >
> >
> > Very basic. No rewrites.
> >
> > location ^~ /monit {
> > location ~* ^/monit/(?<monit_request_uri>.*)$ {
> > proxy_pass http://127.0.0.1:2812/$monit_request_uri;
> > proxy_set_header Host $host;
> > }
>
> Err, make that:
>
> location ^~ /monit {
> location ~* ^/monit(?<monit_request_uri>.*)$ {
> proxy_pass http://127.0.0.1:2812/$monit_request_uri;
> proxy_set_header Host $host;
> }
>
> This way https://myserver/monit won't give a 404.

The regex is not required:

location ^~ /monit/ {
proxy_pass http://127.0.0.1:2812/;
proxy_set_header Host $host;
}

Requests to "/monit" will be redirected to "/monit/" automatically.


--
Igor Sysoev
http://nginx.com/support.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

another "nested locations" question

aweber September 25, 2012 10:08PM

Re: another "nested locations" question

Maxim Dounin September 26, 2012 11:46AM

monit rewrite

aweber September 26, 2012 03:02PM

Re: monit rewrite

António P. P. Almeida September 26, 2012 05:58PM

Re: monit rewrite

António P. P. Almeida September 26, 2012 06:04PM

Re: monit rewrite

Igor Sysoev September 27, 2012 03:40AM

Re: monit rewrite

António P. P. Almeida September 27, 2012 03:54AM

Re: monit rewrite

Igor Sysoev September 27, 2012 03:56AM

Re: monit rewrite

Mark Alan September 27, 2012 06:18AM

Re: monit rewrite

Igor Sysoev September 27, 2012 06:30AM

Re: monit rewrite

Mark Alan September 27, 2012 07:26AM

Re: another "nested locations" question

aweber September 27, 2012 09:08AM

Re: another "nested locations" question

Maxim Dounin September 27, 2012 09:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 94
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready