3

I have an Nginx server block that handles requests and simply serves files from a directory. However, even though the file index.html exists, it does not serve it, not at / nor at /index.html. This problem also occurs for files that I know to exist in the site root directory.

server {
    

    root /var/www/mysite/html/;
        index index.html index.htm index.nginx-debian.html;

        server_name example.com;

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

}

example.com should simply load the contents of index.html, but it does not.

2
  • Would you please add access.log and error.log to the question?
    – Andromeda
    Commented Apr 10, 2023 at 19:40
  • @Andromeda (apologies for the egregiously late response) neither access.log nor error.log were relevant to the issue I was having. I fixed it at the time, but I seem to have forgotten what the solution was now. I will post the solution if I remember/find it. All I remember is that it was within this file (/etc/nginx/sites-enabled/whatever). (it may have been that extra curly bracket at the end)
    – glass1212
    Commented Oct 3, 2023 at 7:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.