為了加強網站安全性,我們除了限制目錄權限外,還需要禁用某此目錄禁止執行php。在IIS中可以直接將目錄的腳本執行權限去掉,而針對非windows系統如何做呢?
接下來的文章將簡單的介紹不同的webserver如何禁用php執行。。。。
<Directory /website/attachments>
php_flag engine off
</Directory>
禁用單個目錄:
location /upload/ {
location ~ .*\.(php)?$
{
deny all;
}
}
禁用多個目錄:
location ~* ^/(upload|images)/.*\.(php|php5)$
{
deny all;
}
Lighthttpd:
$HTTP["url"] =~ “^/(forumdata|templates|customavatars?)/” {
fastcgi.server = ()
}
Apache
<Location “/forumdata”>
php_admin_flag engine off
Options -ExecCGI
AddType text/plain .html .htm .shtml .php
</Location>