【问题标题】:codeigniter pagination is not working and nginx shows not foundcodeigniter 分页不起作用,nginx 显示未找到
【发布时间】:2017-08-16 10:39:34
【问题描述】:

我正在使用控制器中的这些配置在 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;
            }
        }

我找不到解决办法,希望你们能解决我的问题

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

【问题讨论】:

    标签: php codeigniter nginx pagination


    【解决方案1】:

    为您的站点使用这个 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;
             }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-02
      • 1970-01-01
      • 2018-07-26
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多