簡體   English   中英

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放到根文件夾,現在一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM