So I have a website.

www.example.com directory pointed at /var/www/html/

I can load a webpage at


The file for that page is at


that index.html has a style sheet and object in the foo folder and tries to request it using


However, bar.css returns 404 not found even though it's at


What gives? The files have 644 user rights. If index.html can be found shouldn't the other files be too?

  • 1
    Update your question with the nginx configuration file(s) and relevant entries from your nginx-access.log and nginx-error.log Sep 4, 2016 at 8:07
  • logs are located at /var/log/<application name>/ Sep 4, 2016 at 14:08
  • Maybe the execute permission wasn't set on the parent directory(s). In order to view files inside a directory, you must be able to execute the directories. Aug 4, 2017 at 15:17

1 Answer 1


Your folders must be set to file permission 755 using chmod. I successfully got it working after the following steps:

After changing the owner of foo/

$ /var/www/html# chown root foo

and the subfiles to root, as well as changing the chmod of foo/ to 755

chmod 755 foo

to mimic /var/www/html/ 's permissions, my files became accessible.

Remember to use

ls -l 

in your directory to check for the right file permissions. Also check your access and error logs at /var/log/nginx/ (this is accurate for debian at the very least, since this is what I am using)

If you can't find your log files, use

find / | grep error.log > results.txt

and open results.txt with your favourite text editor such as vi results.txt (Assuming you're on a server and it's easier to read text files than the terminal).

Thank you to Richard for telling me to check my logs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .