codeigniter分页不起作用,找不到nginx

时间:2017-08-16 10:39:34

标签: php codeigniter nginx pagination

我正在使用我的控制器中的这些配置在codeigniter中创建分页。

$config = array();
$config['base_url'] = base_url()."api/EtransProxy/getSettlement";
$config['total_rows'] = $this->Do_model->totalFiltered();
$config['per_page'] = 10;
$config['uri_segment'] = 4;

$this->pagination->initialize($config);
$page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;

并显示此消息:

404 Not Found
nginx/1.10.2

我的nginx.conf:

location /eTransportation/{
            alias  /var/www/eTransportation/;
            try_files $uri $uri/ /eTransportation/index.php;

            location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index index.php;
                fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
            }
        }

我无法找到解决方案,我希望你们能解决我的问题

编辑: 最后我找到了解决方案,错误是我的数据库查询和模型

1 个答案:

答案 0 :(得分:0)

将此nginx.conf用于您的网站,您的情况的正确配置必须与此类似:

server {
        server_name yoursitename.com;
        root /usr/share/nginx/www/flo2go/;
        index index.php index.html index.htm;
        location / {
            try_files $uri $uri/ /index.php;
        }

        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
            expires           15d;
        }

        location ~ \.php$ {
            include /etc/nginx/fastcgi_params;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/www/flo2go/index.php;
            fastcgi_param  REQUEST_URI      $request_uri;
            fastcgi_param  QUERY_STRING     $query_string;
            fastcgi_param  REQUEST_METHOD   $request_method;
            fastcgi_param  CONTENT_TYPE     $content_type;
            fastcgi_param  CONTENT_LENGTH   $content_length;
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
         }
    }