NOTE: It is not advisable to do this, use /var/www/
or similar directories to store your static files.
Okay, now if you must keep your files in /root
then follow along.
Consider the static files are in /root/site/static/
path.
- Run
sudo chmod -R 0755 /root
- Run
sudo chmod -R 0755 /root/site
- Run
sudo chown -R "$USER":www-data /root/site
(replacewww-data
with the username of your nginx user with whatever user is used innginx.conf
usually located at/etc/nginx
) - Restart Nginx, now your static files should be accessible.
- Use
namei -l /root/site/static/somefile
to check if necessary permissions are set in case of issues.