nginx git repository

Grzegorz Nosek grzegorz.nosek at
Sat Oct 6 19:24:06 MSD 2007

2007/10/5, Igor Sysoev <is at>:
> On Fri, Oct 05, 2007 at 02:35:23PM +0200, Grzegorz Nosek wrote:
> >  - nested locations -- this is currently WIP.
> What exatly this means ? nginx already has support of nested locations,
> though incomplete.

I'm not reinventing nested locations -- I have noticed that nginx
supports them partially and I want them to be supported completely
(note that I have replaced my previous code with something hopefully
less braindead).

The patch set currently consists of the top 5 commits.

The first two lay some foundations, namely they store cf and cf->ctx
inside core module's loc_conf for further modules' reference. This
allows the merge stage to access other modules' configuration (removes
the limitation commented in ngx_http_config.h). This is required e.g.
for the fastcgi module which needs to set clcf->handler.

It also converts the script engine from overriding the configuration
to merging it at run time (for if {} blocks). Merging it at
configuration parsing/merging time would be nicer (no request-time
overhead) but would require more intrusive changes to the rewrite
module. Maybe soon.

The other three build upon this foundation to support configuration
inheritance of fastcgi, proxy and rewrite modules.

The net result is that a simple configuration of:

location / {
    location /secret {
        auth_basic "Secret";
        auth_basic_user_file /etc/nginx/htpasswd;
    if (!-f $request_filename) {
        fastcgi_pass (somewhere);

works as expected (all nonexistent files are passed to fastcgi, even
under /secret, and also all URLs under /secret require authentication,
even dynamic ones).

Also, please consider applying to your tree:;a=commitdiff;h=0ec0c91de07399f4c2b8f43cd88e0fa459a22a79
(Don't add double WWW-Authenticate headers);a=commitdiff;h=9cac24c18d4eb4a2946f9722bb021087d660a42f
(Remember original error code when an error occurs while serving error pages)

The first one is a simple bugfix I have reported some time ago. The
other one makes error handling more intuitive when error pages are
missing, i.e. if the error page cannot be retrieved, report the
original error which caused the page to be looked up in the first
place, instead of the error while retrieving the error page (yes, this
sounds convoluted). For example:

error_page 403 /nonexistent.html;
deny all;

would serve the 404 error (as that's the last one encountered). With
this patch applied, it properly returns 403.

Best regards,
 Grzegorz Nosek

More information about the nginx mailing list