Not existant files passed to php backend
Sean Allen
sean at monkeysnatchbanana.com
Thu Aug 21 02:57:52 MSD 2008
>
>> Our entire setup is built around these right now.
>
> Could you show example of the setup ?
>
there is a good bit of cruft in this as it has built up over 18 months
and was started when i knew basically zip about nginx.
its also very site specific ( our software does amusing things with
urls... ), kind of the uri equivalent of how i abused strings
in the if statements below to simulate 'and' for nginx if.
that said, here are the important parts.... as noted, its all built
around if statements... largely because
this all is already inside location blocks ( i can provide more
context if you need. )
set $dynamic 0;
set $handler "lp";
set $real_file $request_filename;
if ( $uri ~* ^/s-([^/]*)/(.*)$ )
{
set $has_lid 1;
set $lid $1;
set $handler $2;
set $real_file $document_root/$handler;
}
# dynamics
if ( !-e $real_file )
{
set $dynamic 1;
}
if ( -e $real_file/index.i )
{
set $dynamic 1;
}
if ( $real_file ~* \.(i|pl)$ )
{
set $dynamic 1;
}
# next 6 lines required if no site has setup any geotargeting
if ( $geotarget = 0 )
{
set $geotarget 0;
set $geotarget_domain 0;
set $geotarget_lid 0;
}
set $dyn_geo "$dynamic:$geotarget";
if ( $dyn_geo = '1:1' )
{
rewrite (.*) http://micro.$geotarget_domain/s-
$geotarget_lid&subid=$lid/$handler redirect;
break;
}
if ( $dynamic )
{
error_page 404 = @memcache;
break;
}
if ( $has_lid )
{
rewrite ^(/s-[^/]*/)(.*)$ /$2;
}
More information about the nginx
mailing list