Location problems

Igor Clark igor at pokelondon.com
Tue Feb 19 14:04:48 MSK 2008


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/.* {
		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









More information about the nginx mailing list