nginx禁止访问某个后缀名的文件

猛然发现通过http://ip:端口号/路径/config.ini竟然能下载项目代码的配置文件,检查nginx配置,原来是没有加限制,立即加上,并记录如下:

location ~* .(ini|docx|txt|doc)$ {  
     deny all;  
} 

 转载:http://blog.csdn.net/ligaofeng/article/details/44872011

原文地址:https://www.cnblogs.com/wawahaha/p/4703606.html