Codeigniter nginx 404 error Codeigniter nginx 404 error codeigniter codeigniter

Codeigniter nginx 404 error


Right config for your situation must look simular to this:

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;     }}

Main problem with current config is 2 .php location blocks and if which is evil.


please add following lines to your config

if (!-e $request_filename) {      rewrite ^.*$ /index.php last;}

it works for me


Check the naming s of you Controller , View, Model and Database.

if you do this in your controller:

$this->load->view('main');

then the filename of your view must be same as you wrote in your controller:

main.php