Location confusion

Igor Sysoev is at rambler-co.ru
Wed Dec 5 18:40:39 MSK 2007


On Wed, Dec 05, 2007 at 03:20:48PM +0000, Igor Clark wrote:

> Hi there Igor et al,
> 
> How do I make
> 
> 	location ~ .php$ {
> 		// fastcgi stuff
> 	}
> 
> co-operate with
> 
> 	location ~ /admin/.* {
> 		// auth_basic stuff
> 	}
> 
> so that anything under /admin/ requires a username & password, but PHP  
> still serves the php files?
> 
> At the moment the "~ .php$" block seems to be taking precedence,  
> meaning that e.g. /admin/index.php is served without a username &  
> password, which is not what I intend. I've tried various combinations  
> but none have done exactly what I want; I'm sure it's simple!

    location ~ \.php$ {
        # fastcgi stuff
    }

    location ^~ /admin/ {
        # auth_basic stuff

        location ~ \.php$ {
            # fastcgi stuff
        }
    }

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list