nginx apache lighthttpd 禁止某个目录执行PHP文件

默北 Nginxnginx apache lighthttpd 禁止某个目录执行PHP文件已关闭评论9,9811字数 430阅读1分26秒阅读模式

安全问题无小事,死生之地,存亡之道,不可不察也。有关web站点安全设置可以参见:nginx安全配置Linux下Apache安全配置策略lnmp架构下php安全配置分享确保nginx安全的10个技巧Linux系统必备安全配置

本文主要讲述针对nginx、Apache、lighthttpd三大web容器的针对某个特定的目录禁止执行PHP等程序。文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-apache-lighthttpd-disable-php-execute-of-special-directory/

nginx

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

Apache

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

lighthttpd

$HTTP["url"] =~ "^/(forumdata|templates|upload|images)/" { 
	fastcgi.server = () 
}
文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-apache-lighthttpd-disable-php-execute-of-special-directory/文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-apache-lighthttpd-disable-php-execute-of-special-directory/
weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
默北
  • 本文由 发表于 29/07/2014 01:00:02
  • 转载请务必保留本文链接:https://www.ttlsa.com/nginx/nginx-apache-lighthttpd-disable-php-execute-of-special-directory/