Using nginx and Drupal, how do I serve a 404 error for static files and directories that exist?

view full story

http://serverfault.com – I deploy a Drupal web site using git (well, OK, the developers deploy it; I try to keep them out of trouble), and for that reason the site has a directory .git and a file .gitignore in the document root. Currently the permissions on the files are sufficient to cause nginx to return a 403 Forbidden error if these files are accessed in the web browser. However, I would like nginx to completely deny the existence of this file and directory, and return 404 if someone tries to access them in the browser. But wait, there's more! What I really want to happen is for the browser to receive the 404 (HowTos)