首页 > 技术点滴 > nginx apache lighttpd 禁止某些目录执行php

nginx apache lighttpd 禁止某些目录执行php

2014年9月25日 baoz 阅读评论

If your web server is apache ,you can add follow line:

<Directory /website/attachments>
php_flag engine off
</Directory>

We want disable upload directory php execute privileges on nginx,It’s so simple

location /upload/ {
location ~ .*\.(php)?$
{
deny all;
}
}

limit more directory

location ~* ^/(upload|images)/.*\.(php|php5)$
{
deny all;
}

If your web server is lighthttpd you can

$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>

Hope it will help you.

分类: 技术点滴 标签: , ,
  1. 本文目前尚无任何评论.