当前位置:首页 > PHP教程 > Apach > 列表

apache nginx设置目录无执行权限的方法

发布:smiling 来源: PHP粉丝网  添加日期:2013-11-23 17:27:50 浏览: 评论:0 

apache nginx设置目录无执行权限的方法web服务有iis,apache,nginx,使用操作系统无非是windows or *nux

  1. location ~ ^/upload/.*.(php教程|php5)$  
  2. {  
  3. deny all;  
  4. } 

来看俩段通常对上传目录设置无权限的列子,配置如下:

  1. <directory "/var/111cn.net/upload"> 
  2. <filesmatch ".php"> 
  3. order allow,deny 
  4. deny from all 
  5. </filesmatch> 
  6. </directory> 

*nux就不同了,大家都是知道的*nux操作系统是区分大小写的

  1. <directory "/var/www/upload"> 
  2. <filesmatch "(?i:.php)"> //?是尽可能多的匹配.php的字符串,i是不区分大小写,然后冒号后面跟上正则表达式 
  3. order allow,deny 
  4. deny from all 
  5. </filesmatch> 
  6. </directory> 

另外看一一nginx虚拟主机防webshell完美版 nginx.conf

  1. server 
  2. { 
  3. listen 80; 
  4. server_name www.a.com; 
  5. index index.html index.htm index.php; 
  6. root /data/htdocs/www.a.com/; 
  7. #limit_conn crawler 20; 
  8. location ~ .*.(php|php5)?$ 
  9. {  
  10. #fastcgi_pass unix:/tmp/php-cgi.sock; 
  11. fastcgi_pass 127.0.0.1:9000; 
  12. fastcgi_index index.php; 
  13. include fcgi.conf; 
  14. } 
  15. } 
  16. server 
  17. { 
  18. listen 80; 
  19. server_name www.b.com; 
  20. index index.html index.htm index.php; 
  21. root /data/htdocs/www.phpfensi.com/; 
  22. #limit_conn crawler 20; 
  23. location ~ .*.(php|php5)?$ 
  24. {  
  25. #fastcgi_pass unix:/tmp/php-cgi.sock; 
  26. fastcgi_pass 127.0.0.1:9000; 
  27. fastcgi_index index.php; 
  28. include fcgi.conf; 
  29. } 
  30. } 

Tags: apache nginx 无执行权限

分享到: