全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 8691|回复: 11

[已解决] 为什么nginx禁止了目录PHP执行权限 为什么还不行?

[复制链接]
发表于 2014-5-26 17:09:00 | 显示全部楼层 |阅读模式

  1.                 location ~ /(data|uploads)/.*\.(php|php5)?$
  2.                         {
  3.                                 deny all;
  4.                         }
复制代码



我设置的对吗?



用都是 LNMP






发表于 2014-5-26 17:11:01 | 显示全部楼层
别人换一个后缀岂不是就能上传了?
 楼主| 发表于 2014-5-26 17:12:37 | 显示全部楼层
阔空晴云 发表于 2014-5-26 17:11
别人换一个后缀岂不是就能上传了?

是UPLOADS 取消PHP执行权限   不是禁止上传PHP
发表于 2014-5-26 17:15:08 | 显示全部楼层
  1.                 location ~ /(data|uploads|templets)/.*\.(php|php5)?$ {
  2.                                 deny all;
  3.                         }
复制代码


是对的啊,我这都有效~~
 楼主| 发表于 2014-5-26 17:30:31 | 显示全部楼层
junhan 发表于 2014-5-26 17:15
是对的啊,我这都有效~~

那就非常奇怪了

/usr/local/nginx/conf/vhost/192.168.1.222.conf


并重启了 NGINX     
发表于 2014-5-26 17:32:21 | 显示全部楼层
亮亮同学 发表于 2014-5-26 17:30
那就非常奇怪了

/usr/local/nginx/conf/vhost/192.168.1.222.conf

你贴个完整的配置文件看看
 楼主| 发表于 2014-5-26 17:34:14 | 显示全部楼层
junhan 发表于 2014-5-26 17:32
你贴个完整的配置文件看看

server_name www.abc.com;

我绑定个域名就行了    本地HOST ABC.COM
 楼主| 发表于 2014-5-26 18:00:27 | 显示全部楼层
junhan 发表于 2014-5-26 17:32
你贴个完整的配置文件看看
  1. log_format  myWebLog  '$remote_addr - $remote_user [$time_local] "$request" '
  2.              '$status $body_bytes_sent "$http_referer" '
  3.              '"$http_user_agent" $http_x_forwarded_for';
  4. server
  5.         {
  6.                 listen       80;
  7.                 server_name www.abc.com;
  8.                 index index.html index.htm index.php default.html default.htm default.php;
  9.                 root  /mnt/wwwroot/web;

  10.                 include myRewrite.conf;
  11.                 location ~ .*\.(php|php5)?$
  12.                         {
  13.                                 try_files $uri =404;
  14.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  15.                                 fastcgi_index index.php;
  16.                                 include fcgi.conf;
  17.                         }

  18.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  19.                         {
  20.                                 expires      30d;
  21.                         }

  22.                 location ~ .*\.(js|css)?$
  23.                         {
  24.                                 expires      12h;
  25.                         }
  26.                        
  27.                 location ~ /(data|uploads)/.*\.(php|php5)?$
  28.                         {
  29.                                 deny all;
  30.                         }

  31.                 access_log  /home/wwwlogs/myWebLog.log  myWebLog;
  32.         }
复制代码




还是不行   刚刚看错了  误以为可以了


发表于 2014-5-26 18:10:27 | 显示全部楼层
  1. location ~ /(data|uploads)/.*\.(php|php5)?$
  2.                         {
  3.                                 deny all;
  4.                         }
复制代码

提到
  1. location ~ .*\.(php|php5)?$
  2.                         {
  3.                                 try_files $uri =404;
  4.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  5.                                 fastcgi_index index.php;
  6.                                 include fcgi.conf;
  7.                         }
复制代码


前面
发表于 2014-5-26 18:12:17 | 显示全部楼层
按9楼的这样,把这个放到上面应该就可以了~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-12 18:38 , Processed in 0.061806 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表