Error 404 with Codeigniter

September 18, 2015 10.7k views
Nginx LEMP

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

1 comment
  • 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.

1 Answer
Have another answer? Share your knowledge.

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