Error 404 with Codeigniter

Posted September 18, 2015 12.9k views

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

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.

Submit an Answer
1 answer