为了安全起见,我们一般会对上传目录禁止运行php脚本
修改nginx.conf配置文件
禁止单目录:
location ~* ^/attachments/.*.(php|php5)$ {
deny all;
}
禁止多目录:
location ~* ^/(attachments|upload)/.*.(php|php5)$ {
deny all;
}
需要注意两点:
1、以上的配置文件代码需要放到 location ~ .php{…}上面,如果放到下面是无效的
2、attachments需要写相对路径,不能写绝对路径
3、不要忘记重启nginx呀,service nginx restart
———————



![[历史] 重大事件内幕:邓小平的临终时刻首次公开(图)-微慑信息网-VulSee.com](http://att.cymedia.com.cn/images/2006-03-21/1142909847034.jpg)
![[python] 使用flask+gunicorn报错Request Line is too large (8192 > 4094) 的解决方法-微慑信息网-VulSee.com](https://vulsee.com/wp-content/uploads/2022/06/ce37969186e9c05aa99dd1970d205a51.png)

![[性爱]“性爱”初体验-微慑信息网-VulSee.com](http://img.bimg.126.net/photo/AR5bebs3FLxA9pY0_CRgKA==/3956975222599852160.jpg)

![[八卦] 王婷婷—揭秘一个大三女生的性爱录像-微慑信息网-VulSee.com](http://free.86hy.com/crack/pic/1.jpg)
![[随笔]今天国际警察节-微慑信息网-VulSee.com](http://photo.sohu.com/20041017/Img222528326.jpg)

青云网
