nginx apache lighthttpd 禁止某个目录执行PHP文件
安全问题无小事,死生之地,存亡之道,不可不察也。有关web站点安全设置可以参见:nginx安全配置、Linux下Apache安全配置策略、lnmp架构下php安全配置分享、确保nginx安全的10个技巧、Linux系统必备安全配置。
本文主要讲述针对nginx、Apache、lighthttpd三大web容器的针对某个特定的目录禁止执行PHP等程序。
nginx
1
2
3
4
5
6
|
location
/
upload
/
{
location
~
.
*
\
.
(
php
)
?
$
{
deny
all
;
}
}
|
1
2
3
4
|
location
~
*
^
/
(
upload
|
images
)
/
.
*
\
.
(
php
|
php5
)
$
{
deny
all
;
}
|
Apache
1
2
3
|
<
Directory
/
webroot
/
attachments
>
php_flag
engine
off
<
/
Directory
>
|
lighthttpd
1
2
3
|
$
HTTP
[
"url"
]
=
~
"^/(forumdata|templates|upload|images)/"
{
fastcgi
.
server
=
(
)
}
|
收 藏
成长的对话版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!