Location problems

Denis F. Latypoff denis at gostats.ru
Tue Feb 19 14:23:46 MSK 2008


Hello Igor,

Tuesday, February 19, 2008, 5:04:48 PM, you wrote:

> Hi folks,

> I often have problems trying to use different locations without having  
> to duplicate config.
> I think I must be thinking about it the wrong way!

> Basically I just want to make /admin/ password-protected, but inherit  
> all the other config.

> So I tried this:

>         location / {
>                 include /path/to/php.conf;      # includes all fastcgi stuff and some  
> rewrites
>                 location ~ /admin/.* {
>                         auth_basic              "Restricted";
>                         auth_basic_user_file    /path/to/admin.htusers;
>                 }
>          }

> But it doesn't work, so I tried this way which I've made work before:

>         location / {
>                 include /path/to/php.conf;
>          }

-          location ~ /admin/.* {
+          location /admin { # not tested
>                 auth_basic              "Restricted";
>                 auth_basic_user_file    /path/to/admin.htusers;
>                 include /path/to/php.conf;
>         }

> But this doesn't work either, it includes the PHP file but doesn't do  
> the auth, and there's no error in the log. I've tried various  
> permutations on ~ /admin/.* too.

> What am I doing wrong?

> Many thanks,
> Igor

> --
> Igor Clark // POKE // 10 Redchurch Street // E2 7DD // +44 (0)20 7749  
> 5355 // www.pokelondon.com



-- 
Best regards,
 Denis                            mailto:denis at gostats.ru






More information about the nginx mailing list