LEMP on CentOS 6 returns 404 errors

February 28, 2014 2.5k views
I have created a CentOS 6.5 x64 droplet with LEMP installed as described here: It is working fine, I have ported a sample CodeIgniter application ( under but when I try to click to any of the links it returns 404 error. I also tried to install FUEL CMS but again it comes up with a 404 error where when on works fine. Obviously it has to do with the nginx conf file but I have tried many options without luck! The /etc/nginx/conf.d/default.conf file is: server { listen 80; server_name; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # pass the PHP scripts to FastCGI server # location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass unix:/tmp/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
7 Answers
you should enable debug mode (development mode) in your php framework and see why that happens
Try adding try_files $uri $uri/ /index.php; after index index.php index.html index.htm; .
The framework is already on debug mode fatih. But it is not the framework that returns a 404 error, I think.
Kamal your suggestion returns a "No file is specified."
I could make it work and in the end I am rebuilding the droplet and I will install LAMP!
Correction: I couldn't...
Kamal your suggestion returns a "No file is specified."
Good, that means we're getting there :]

If you haven't wiped your droplet yet, can you pastebin the output of
tail -30 /var/log/nginx/error.log
It's gone!
I am installing LAMP along with varnish.
Have another answer? Share your knowledge.