Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 代码点火器+;Nginx必须呈现框架提供的404页面_Php_Codeigniter_Nginx_Http Status Code 404 - Fatal编程技术网

Php 代码点火器+;Nginx必须呈现框架提供的404页面

Php 代码点火器+;Nginx必须呈现框架提供的404页面,php,codeigniter,nginx,http-status-code-404,Php,Codeigniter,Nginx,Http Status Code 404,所以,我有下一个问题。这是我的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.ht

所以,我有下一个问题。这是我的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放入根文件夹,现在一切正常。

在application/config下有一个名为routes.php的文件,您可以在其中编辑404页面,例如$route['404_override']='welcome';如果我使用ApacheCodeIgniter呈现自己的404页面。如果我使用Nginx,它将呈现Nginx-404页面。这是个问题。自定义404页面也不起作用