用户
 找回密码
 入住 CI 中国社区
搜索
查看: 13994|回复: 6
收起左侧

linux+Nginx+CodeIgniter Access denied问题.

[复制链接]
发表于 2013-7-9 16:55:43 | 显示全部楼层 |阅读模式


控制器Welcome是默认初始控制器
$route['default_controller'] = "welcome";


控制器Welcome代码:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
    public function index()
    {
        $this->load->view('welcome_message');
    }
}

nginx虚拟主机配置代码如下:
server
{
        listen       80;
        server_name  www.hhhbb.com;
        #charset koi8-r;
        #access_log  /var/log/nginx/host.access.log  main;
        location / {
            root   /var/www/ename/hhhbb/;
            index  index.html index.htm index.php;
        }
        # redirect server error pages to the static page /40x.html
        #
        error_page  404              /404.html;
        location = /40x.html {
            root    /var/www/ename/hhhbb/;
        }
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root    /var/www/ename/hhhbb/;
        }
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
    # location ~ \.php?($|/)
        location ~ \.php?($|/) {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/ename/hhhbb/$fastcgi_script_name;
            include        fastcgi_params;         
         set $path_info "";
            set $real_script_name $fastcgi_script_name;
        # if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
           #   set $real_script_name $1;
           #    set $path_info $2;
                #  }
        if ($uri ~* "^\/(.+?\.php)(/.*)$")
            {
                 set $script $1;
                 set $path_info $2;
            }
        }
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
      #  location ~ /\.ht {
        #    allow  all;
       # }
}
文件夹的权限没问题
access.log 文家记录:
127.0.0.1 - - [09/Jul/2013:16:28:56 +0800] "GET /index.php/welcome/index HTTP/1.1" 403 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0" "-"
求大神指导,弄了一天了,解决不了,一直找不到什么原因。

 楼主| 发表于 2013-7-9 16:58:27 | 显示全部楼层
怎么图片都没有了,坑爹!
发表于 2013-7-9 17:23:58 | 显示全部楼层
 楼主| 发表于 2013-7-10 08:56:23 | 显示全部楼层
本帖最后由 我︵★怀念的 于 2013-7-10 08:58 编辑
曜日晨阳 发表于 2013-7-9 17:23
http://codeigniter.org.cn/forums/thread-7815-1-1.html

LOOK this!

控制器Welcome是默认访问的控制器,直接输入可以访问
                                               
但是运用了url重写就这样了
                                             
都是访问限制。权限没有问题整个文件夹已经设为777
                                             

发表于 2017-4-23 20:33:27 | 显示全部楼层
最后弄好了没?
发表于 2017-4-23 20:36:04 | 显示全部楼层
我在nginx下也是遇到这个问题,在index.php下的文件夹访问的是Access denied.403.但是放在www根目录下的php可以访问,就是ci的index.php下的文件不能访问,要是解决给个共享或qq一下1958290443
发表于 2017-4-24 14:43:21 | 显示全部楼层
maccarty 发表于 2017-4-23 20:36
我在nginx下也是遇到这个问题,在index.php下的文件夹访问的是Access denied.403.但是放在www根目录下的php ...

index.php 为什么不在 www 根目录?

本版积分规则