apache nginx设置目录无执行权限的方法
apache nginx设置目录无执行权限的方法web服务有iis,apache,nginx,使用操作系统无非是windows or *nux
location ~ ^/upload/.*.(php教程|php5)$
{
deny all;
}
来看俩段通常对上传目录设置无权限的列子,配置如下:
<directory "/var/zzzyk.com/upload">
<filesmatch ".php">
order allow,deny
deny from all
</filesmatch>
</directory>
*nux就不同了,大家都是知道的*nux操作系统是区分大小写的
<directory "/var/www/upload">
<filesmatch "(?i:.php)"> //?是尽可能多的匹配.php的字符串,i是不区分大小写,然后冒号后面跟上正则表达式
order allow,deny
deny from all
</filesmatch>
</directory>
另外看一一nginx虚拟主机防webshell完美版
nginx.conf
server
{
listen 80;
server_name www.a.com;
index index.html index.htm index.php;
root /data/htdocs/www.a.com/;#limit_conn crawler 20;
location ~ .*.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}}
server
{
listen 80;
server_name www.b.com;
index index.html index.htm index.php;
root /data/htdocs/www.zhutiai.com/;#limit_conn crawler 20;
location ~ .*.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}}
补充:Php教程,apache