Disable PHP in specific directories

mindfrost82 nginx-forum at nginx.us
Thu Jun 10 19:59:09 MSD 2010


I have nginx setup with PHP as FastCGI.

On my server, I have a couple of upload (writeable) directories and I want to disable nginx/php from serving php files in those directories (and all subdirectories).

I've tried creating some location rules in nginx, but I can't seem to get it working.

For example, if I have /public_html/uploads

Then I have /usr1, /usr2, /usr3, etc as subdirectories under /uploads...

I want to disable php in the uploads directory and all subdirectories.  Or, if its possible to redirect anyone that tries to access a *.php file in those directories to a HTML error message file...either way.

Thanks!

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




More information about the nginx mailing list