Location problems

Igor Clark igor at pokelondon.com
Fri Feb 29 18:36:44 MSK 2008


Thanks very much Igor, that's really helpful, and shows a completely  
different approach from the one I've been taking. Excellent stuff.

Igor

On 29 Feb 2008, at 11:31, Igor Sysoev wrote:

> On Fri, Feb 29, 2008 at 11:13:48AM +0000, Igor Clark wrote:
>
>> Hi Igor,
>>
>> Everything that doesn't exist as a file gets routed to either /
>> frontend.php, or /admin.php if the URI starts with /admin. If so,  
>> it's
>> IP-restricted in this case, basic_auth protected in other cases.
>>
>> So we want to be able to do:
>>
>> /	->	/frontend.php	-> fastcgi
>>
>> /speakers/show/all	-> /frontend.php?control_path=/speakers/show/all  
>> ->
>> fastcgi
>>
>> /admin	->	/admin.php	->	fastcgi, protected
>>
>> /admin/speakers/edit/32	
>> /admin.php?control_path=/admin/speakers/edit/ 32	->	fastcgi,
>> protected
>>
>> I'm just wondering whether our approach of "rewrite first, then deal
>> with locations" is just wrong, maybe we should deal with locations
>> first and then rewrite if necessary.
>
>        location / {
>            error_page  404 = @fallback;
>        }
>
>        location @fallback {
>            fastcgi_pass   ...
>            fastcgi_param  SCRIPT_FILENAME  /path/to/frontend.php;
>            fastcgi_param  QUERY_STRING     control_path=$uri;
>            ...
>        }
>
>        location /admin {
>            allow   1.2.3.4;
>            deny    all;
>            error_page  404 = @admin;
>        }
>
>        location @admin {
>            fastcgi_pass   ...
>            fastcgi_param  SCRIPT_FILENAME  /path/to/admin.php;
>            fastcgi_param  QUERY_STRING     control_path=$uri;
>            ...
>        }
>
>
> -- 
> Igor Sysoev
> http://sysoev.ru/en/
>

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









More information about the nginx mailing list