Codeigniter+Nginx必须呈现框架提供的404页面


Codeigniter + Nginx must render 404 page provided by framework

所以,我有下一个问题。这是我的nginx配置

server {
    disable_symlinks off;
    listen       80;
    server_name  g9tv.loc;
    charset utf-8;
    #access_log  logs/host.access.log  main;
    location / {
        root   /home/dejmos/www/g9tv;
        index  index.html index.htm index.php;
        try_files   $uri $uri/ /index.php;
    }

    error_page  404              /index.php;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /home/dejmos/www/g9tv;
    }
    # 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$ {
        try_files $uri =404;
        fastcgi_intercept_errors on;
        root           /home/dejmos/www/g9tv;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /home/dejmos/www/g9tv$fastcgi_script_name;
        include        fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /'.ht {
        deny  all;
    }
}

当我转到服务器上不存在的页面时,我得到了nginx提供的404页面,但我需要得到codeigniter show_404()函数提供的404页。

问题已解决。它是由子文件夹引起的。我把Codeigniter放在根文件夹中,现在一切都好了。