nginx hidden file deny configuration?

I am using the below standard config to block download of hidden files from nginx :

#Prevent (deny) Access to Hidden Files with Nginx
    location ~ /\. {
            access_log off;
            log_not_found off; 
            deny all;
        }

But this config is also blocking genuine requests like :

2013/10/09 17:24:46 [error] 20121#0: *593378 access forbidden by rule, client: XX.55.XXX.201, server: XYZ.org, request: "GET /vip/validate.php?id=dfddfQ&title=.Mytitle HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "xyz.org"

Solution 1:

You can debug which location from you nginx config applied to your request by adding "debug" to error.log:

error_log /path-to/error.log debug;

2015/09/24 16:22:12 [debug] 16458#0: *1539 http script copy: "/static.php"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 http script args  
2015/09/24 16:22:12 [debug] 16458#0: *1539 http script copy: "resource="  
2015/09/24 16:22:12 [debug] 16458#0: *1539 http script capture: "frontend/Magento/luma/en_US/mage/calendar.css"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 http script regex end  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: "/"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: "pub"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: "static/"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: "setup"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: ~ "/\."  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: ~ "/media/theme_customization/.*\.xml$"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: ~ "^/errors/.*\.(xml|phtml)$"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: ~ "cron\.php"  
2015/09/24 16:22:12 [debug] 16458#0: *1539 test location: ~ "\.php$"  
**2015/09/24 16:22:12 [debug] 16458#0: *1539 using configuration "\.php$"**