So I have a website.
www.example.com directory pointed at /var/www/html/
I can load a webpage at
www.example.com/foo/
The file for that page is at
/var/www/html/foo/index.html
that index.html has a style sheet and object in the foo folder and tries to request it using
www.example.com/foo/bar.css
However, bar.css
returns 404 not found even though it's at
/var/www/html/foo/bar.css
What gives? The files have 644 user rights. If index.html can be found shouldn't the other files be too?
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.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments