Welcome! Log In Create A New Profile

Advanced

Re: reverse proxy root folder only

Francis Daly
January 07, 2012 05:04AM
On Fri, Jan 06, 2012 at 07:17:42PM -0500, starmonche wrote:

Hi there,

> I have an nginx serverset up and I'm looking for a way to only reverse
> proxy the contents of the root folder. I'm using a location regex with a
> list of the files in root that are allowed and then a second catch-all
> location that goes nowhere but there must be an easier or cleaner way to
> do this.

Conceptually, one location{} for the things you want, plus one for all
else, *is* the easy way to do it.

(That's more or less the same as one location{} for the things you don't
want, plus one for all else.)

Arguably the cleaner way is to have one exact location{} for each thing
you want, plus one for the rest, but I guess you're not looking for that.

So: what is "the contents of the root folder"? If it is "exactly these
file names", then your current

location ~ ^/(one|two|three)$

is correct. If it is "any request without a second /", then

location ~ ^/[^/]*$

should work.

And if you go the other way, and have "location /" as your "this is
the root folder" block, then "all else" would be "any request with two
slashes", which could be

location ~ /.*/

(All untested, by the way.)

Good luck with it,

f
--
Francis Daly francis@daoine.org

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

reverse proxy root folder only

starmonche January 06, 2012 07:17PM

Re: reverse proxy root folder only

Francis Daly January 07, 2012 05:04AM

Re: reverse proxy root folder only

starmonche January 09, 2012 12:01PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready