Question

Error 404 with Codeigniter

Hi, I have recently setup my Droplet with Ubuntu (and nginx), i am currently trying to install Codeigniter and it loaded the Welcome page just fine. However once i deployed my project (which runs well on a local xampp installation) to the server i keep getting 404 errors. This happens when loading the index page as well as any other page. Here is my config:

server {

server_name example.com;

root /usr/share/nginx/project;

index index.html index.php index.htm;

# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
    expires max;
    log_not_found off;
}
location / {
    # Check if a file exists, or route it to index.php.
    try_files $uri $uri/ /index.php;
}

location ~* \.php$ {

fastcgi_pass 127.0.0.1:9000;

    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
 }

}

Any help would be greatly appreciated!

Thank you

Subscribe
Share

This comment has been deleted

You should check your log files.

I installed CodeIgniter following this tutorial and everything is working fine. I do not receive 404 errors. So you may find the article useful.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi,

Please refer to this error guide for Codeignitor - https://ellislab.com/codeigniter/user-guide/general/errors.html