Nginx、Apache、Lighttpd禁止目录执行php配置示例
为了加强网站安全性,我们除了限制目录权限外,还需要禁用某此目录禁止执行php。在IIS中可以直接将目录的脚本执行权限去掉,而针对非windows系统如何做呢?
接下来的文章将简单的介绍不同的webserver如何禁用php执行。。。。
Apache:
代码如下:
<Directory /website/attachments> php_flag engine off </Directory>
Nginx:
禁用单个目录:
代码如下:
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>
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23