May 1, 2015

f Comment

Nginx 1.4.6: Fixing "404 Not Found Error" after migrating from an older version

Amazon I am using Nginx web server version 1.4.6 after migrating from 1.4.1. I used the same Nginx configuration file and I kept getting this error in a web browser when I was trying to access a file in my web directory:

404 Not Found error on nginx/1.4.6 (Ubuntu)

But the file I am trying to access exists at the right location. Why was it working on Nginx 1.4.1 but not working on Nginx 1.4.6?

Solution

You must include the "root" directive inside the server block like so:
server {
        listen 80;
..
        root /home/ubuntu/repository/trunk;
..
}
However, the "root" directive is not necessary inside the server block in the configuration file for nginx/1.4.1; you just need to include the root directive inside the "location" block. Why Nginx changed this behavior from 1.4.1 to 1.4.6 is beyond me.

Questions? Let me know!
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael