找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 76|回复: 10

为什么nginx禁止了目录PHP执行权限 为什么还不行?

[复制链接]

46

主题

42

回帖

248

积分

中级会员

积分
248
发表于 2014-5-26 17:09:00 | 显示全部楼层 |阅读模式
[ol]
  •                 location ~ /(data|uploads)/.*\.(php|php5)?$
  •                         {
  •                                 deny all;
  •                         }[/ol]复制代码


    我设置的对吗?



    用都是 LNMP






  • 回复

    使用道具 举报

    227

    主题

    2105

    回帖

    5005

    积分

    论坛元老

    积分
    5005
    发表于 2014-5-26 17:11:01 | 显示全部楼层
    别人换一个后缀岂不是就能上传了?
    回复

    使用道具 举报

    46

    主题

    42

    回帖

    248

    积分

    中级会员

    积分
    248
     楼主| 发表于 2014-5-26 17:12:37 | 显示全部楼层

    阔空晴云 发表于 2014-5-26 17:11

    别人换一个后缀岂不是就能上传了?

    是UPLOADS 取消PHP执行权限   不是禁止上传PHP
    回复

    使用道具 举报

    749

    主题

    9411

    回帖

    2万

    积分

    论坛元老

    积分
    21181
    发表于 2014-5-26 17:11:00 | 显示全部楼层
    [ol]
  •                 location ~ /(data|uploads|templets)/.*\.(php|php5)?$ {
  •                                 deny all;
  •                         }[/ol]复制代码

    是对的啊,我这都有效~~
  • 回复

    使用道具 举报

    46

    主题

    42

    回帖

    248

    积分

    中级会员

    积分
    248
     楼主| 发表于 2014-5-26 17:15:08 | 显示全部楼层

    junhan 发表于 2014-5-26 17:15

    是对的啊,我这都有效~~

    那就非常奇怪了

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


    并重启了 NGINX     
    回复

    使用道具 举报

    749

    主题

    9411

    回帖

    2万

    积分

    论坛元老

    积分
    21181
    发表于 2014-5-26 17:30:31 | 显示全部楼层

    亮亮同学 发表于 2014-5-26 17:30

    那就非常奇怪了

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

    你贴个完整的配置文件看看
    回复

    使用道具 举报

    46

    主题

    42

    回帖

    248

    积分

    中级会员

    积分
    248
     楼主| 发表于 2014-5-26 17:15:00 | 显示全部楼层

    junhan 发表于 2014-5-26 17:32

    你贴个完整的配置文件看看

    server_name www.abc.com;

    我绑定个域名就行了    本地HOST ABC.COM
    回复

    使用道具 举报

    46

    主题

    42

    回帖

    248

    积分

    中级会员

    积分
    248
     楼主| 发表于 2014-5-26 17:32:21 | 显示全部楼层

    junhan 发表于 2014-5-26 17:32

    你贴个完整的配置文件看看
    [ol]
  • log_format  myWebLog  '$remote_addr - $remote_user [$time_local] "$request" '
  •              '$status $body_bytes_sent "$http_referer" '
  •              '"$http_user_agent" $http_x_forwarded_for';
  • server
  •         {
  •                 listen       80;
  •                 server_name www.abc.com;
  •                 index index.html index.htm index.php default.html default.htm default.php;
  •                 root  /mnt/wwwroot/web;
  •                 include myRewrite.conf;
  •                 location ~ .*\.(php|php5)?$
  •                         {
  •                                 try_files $uri =404;
  •                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  •                                 fastcgi_index index.php;
  •                                 include fcgi.conf;
  •                         }
  •                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  •                         {
  •                                 expires      30d;
  •                         }
  •                 location ~ .*\.(js|css)?$
  •                         {
  •                                 expires      12h;
  •                         }
  •                         
  •                 location ~ /(data|uploads)/.*\.(php|php5)?$
  •                         {
  •                                 deny all;
  •                         }
  •                 access_log  /home/wwwlogs/myWebLog.log  myWebLog;
  •         }
  • [/ol]复制代码



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


  • 回复

    使用道具 举报

    67

    主题

    1128

    回帖

    2565

    积分

    金牌会员

    积分
    2565
    发表于 2014-5-26 17:30:00 | 显示全部楼层
    [ol]
  • location ~ /(data|uploads)/.*\.(php|php5)?$
  •                         {
  •                                 deny all;
  •                         }[/ol]复制代码
    提到
    [ol]
  • location ~ .*\.(php|php5)?$
  •                         {
  •                                 try_files $uri =404;
  •                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  •                                 fastcgi_index index.php;
  •                                 include fcgi.conf;
  •                         }[/ol]复制代码

    前面
  • 回复

    使用道具 举报

    0

    主题

    1

    回帖

    4

    积分

    新手上路

    积分
    4
    发表于 2014-5-26 17:34:14 | 显示全部楼层
    按9楼的这样,把这个放到上面应该就可以了~
    cgs3238 发表于 2014-5-26 18:10

    提到

    感谢 感谢
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋|Discuz! X

    GMT+8, 2025-6-26 10:28 , Processed in 0.018873 second(s), 3 queries , Gzip On, Redis On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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