howto create conditional basic authentication

Ryan Malayter malayter at
Sat Feb 6 01:58:25 MSK 2010

On Fri, Feb 5, 2010 at 4:23 PM, Paul Swielingen <lists at> wrote:
> Hi all,
> I have an operational NGINX server with e few dozen location {}
> definitions
> When a connection is made from an internal network towards the server
> the client browser gets all the pages. Now I like to add external
> access, but I need to require basic authentication. Can this be done
> without duplication of these few dozen location {} definitions or ???

I think creative use of the "include" directive can eliminate the
duplication for you. Keep the config for locations in separate files,
and then include them as appropriate. You can also have an include for


More information about the nginx mailing list