FunnyWeb

据说这里有很多神奇的东西...

apache下禁止某目录解析php文件

2016-05-16 00:23:261892 views

考虑到安全性,常常需要禁止某目录的php文件解析(比如临时文件夹,上传文件夹等),修改方法如下。

vi /etc/httpd/conf/httpd.conf

在httpd.conf中添加以下内容:

<Directory "/var/www/html/other/tempfiles">
<Files ~ ".php">
Order allow,deny 
Deny from all 
</Files>
</Directory>

重启apache使其生效

/etc/init.d/httpd restart