Nginx with php configuration how to block all requests/urls other than two?

c0nw0nk nginx-forum at nginx.us
Thu Jan 29 15:55:21 UTC 2015


map $request $allowonly {
default 1;
~*addmedia\.upload([a-zA-Z0-9-_=&]) 0;
}
location / {
if ($allowonly) {
try_files $uri $uri/ /index.php?$args;
}
}
location ~ \.php$ {
##fastcgi pass etc here
}

That would be my location block to deny all requests except for that single
php url but i cant add the static file to the map request since it would be
handled by PHP when its a static file.

How should make this url be accepted
"sub1.domain.com/media/com_hwdmediashare/assets/swf/Swiff.Uploader.swf"

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,256336,256338#msg-256338



More information about the nginx mailing list