# Why is NGINX serving a 404 here?

**URL:** <https://www.ruby-forum.com/t/why-is-nginx-serving-a-404-here/243187>\
**Category:** NGINX\
**Created:** [August 31, 2015, 2:54am UTC](https://www.ruby-forum.com/t/why-is-nginx-serving-a-404-here/243187 "2015-08-31T02:54:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 31, 2015, 2:54am UTC](https://www.ruby-forum.com/t/why-is-nginx-serving-a-404-here/243187/1 "2015-08-31T02:54:56Z")

</div>

I have a pretty standard test nginx configuration file  
(/etc/nginx/sites-available/default) that was configured to serve a  
sample  
html document.

Here’s the modified portion of the configuration file.

upstream auth{  
server 127.0.0.1:3000;  
}

server {  
listen 80 default\_server;

```
    root /var/www/index.html;

    # Make site accessible from http://localhost/
    server_name _;

    location / {
            try_files $uri $uri/ =404;
    }

    location /auth{
            proxy_pass http://auth;
    }

```

}

And yet, accessing my machine’s IP address seems to return a 404. What’s  
going on here?

I’ve ensured that the permissions of index.html ensure that the file is  
readable, so doesn’t seem to be a permissions issue.

Posted at Nginx Forum:

> **[Why is NGINX serving a 404 here?](https://forum.nginx.org/read.php?2,261327,261327#msg-261327)**
>
> I have a pretty standard test nginx configuration file (/etc/nginx/sites-available/default) that was configured to serve a sample html document. Here's the modified portion of the configuration file. upstream auth{ server 127.0.0.1:3000; }

---

<div class="post-metadata">

**Author:** ![maplesyrupandrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@maplesyrupandrew](https://www.ruby-forum.com/u/maplesyrupandrew)\
**Post date:** [August 31, 2015, 3:39am UTC](https://www.ruby-forum.com/t/why-is-nginx-serving-a-404-here/243187/2 "2015-08-31T03:39:55Z")

</div>

Just a quick look but I noticed this:

`root /var/www/index.html`

I guess you wanted `root /var/www/` !?

Also looking at the logs should probably hint on why the 404 is  
happening,  
but I’m guessing its realted to the above line 🙂

## Melhores Cumprimentos // Best Regards

_Miguel C._  
_IT - Sys Admin & Developer_

On Mon, Aug 31, 2015 at 1:54 AM, maplesyrupandrew [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![maplesyrupandrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@maplesyrupandrew](https://www.ruby-forum.com/u/maplesyrupandrew)\
**Post date:** [September 2, 2015, 7:32pm UTC](https://www.ruby-forum.com/t/why-is-nginx-serving-a-404-here/243187/3 "2015-09-02T19:32:57Z")

</div>

Thanks for the response! I made that change, and I think what was really  
giving the 404 was that I had changed permissions on the `index.html`  
file,  
but not on the var/www/ folder, which I needed so that the nginx user  
group  
could access it. Thanks!

Posted at Nginx Forum:

> **[Re: Why is NGINX serving a 404 here?](https://forum.nginx.org/read.php?2,261327,261395#msg-261395)**
>
> I have a pretty standard test nginx configuration file (/etc/nginx/sites-available/default) that was configured to serve a sample html document. Here's the modified portion of the configuration file. upstream auth{ server 127.0.0.1:3000; }
