Block certain extensions preferably across virtual hosts

kosh nginx-forum at
Mon Nov 8 11:36:04 MSK 2010

I have been working on converting from apache to nginx and I have a

RewriteRule \.(asp|aspx|php|jsp)$ - [F,L]

to block all of those. What would be the best way to convert that to
nginx and is there a way to do it in one place so that all
virtualhosts share it? 

If I could put that in one place so it applies to everything I serve
with nginx it would be much easier to add other things to it over time.
Mostly I want to completely block many extensions since it makes
analyzing errors much simpler.


Posted at Nginx Forum:,148723,148723#msg-148723

More information about the nginx mailing list