为了加强网站安全性,我们除了限制目录权限外,还需要禁用某此目录禁止执行php。在IIS中可以直接将目录的脚本执行权限去掉,而针对非windows系统如何做呢?
接下来的文章将简单的介绍不同的webserver如何禁用php执行。。。。
Apache
php_flag engine off
Nginx
禁用单个目录:
location /upload/ { location ~ .*\.(php)?$ { deny all; } }
禁用多个目录:
location ~* ^/(upload|images)/.*\.(php|php5)$ { deny all; }
lighthttpd
$HTTP["url"] =~ “^/(forumdata|templates|customavatars?)/” { fastcgi.server = () } Apache:php_admin_flag engine off Options -ExecCGI AddType text/plain .html .htm .shtml .php
转自:https://baoz.net/nginx-apache-lighttpd-disable-php/
from www.waitalone.cn.thanks for it.
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论