simple auth question for nested sections

Francis Daly francis at daoine.org
Wed Mar 23 18:14:53 UTC 2016


On Tue, Mar 22, 2016 at 08:00:13PM -0400, Jonathan Vanasco wrote:

Hi there,

> Is there a syntax for nesting the two together, so the /foo/admin would inherit the /foo configuration without the need to redeclare everything?
> 
> 	# something like
> 	location /foo {
> 		proxy_pass  http://127.0.0.1:6543;
> 		location /foo/admin {
> 			auth_basic "Administrator Login";
> 			auth_basic_user_file /etc/nginx/_htpasswd/well-known;
> 		}
> 	}

You would do it exactly as you have done it.

Any directives that inherit do not need to be repeated.

If it does not work for you, that's probably due to proxy_pass not
inheriting.

So repeat that one, but not everything else.

If your example is your exact config, then "everything else" is "nothing",
and there is no immediate benefit to nesting.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list