Nginx – Serving a static page using nginx – getting 404

djangonginx

I'm trying to set up a static page on my website using nginx. The folder has a index.html file along with some static files.

The directory structure looks something like this

olx
--static
--fonts
--index.html

This is how I'm trying to serve the index.html page.

location /olx {
    root /mypath/olx;

    default_type "text/html";
    try_files  $uri $uri.html $uri/index.html index.html;
}

This gives me a 404 error. Any help?

Best Answer

The problem is here:

location /olx {
root /mypath/olx;

Change it to:

location /olx {
root /mypath;