I'm trying to move my root directory from /var/www/html to ~/website for easy access and looser permissions.
Here's /var/log/nginx/error.log.1 with IPs omitted (the original error.log lists an error that has since been fixed):
2019/08/19 12:26:19 [error] 16659#16659: *90 directory index of "/var/www/html/" is forbidden, client: omitted, server: _, request: "GET / HTTP/1.1", host: "omitted"
2019/08/19 21:41:00 [error] 16659#16659: *116 directory index of "/var/www/html/" is forbidden, client: omitted, server: _, request: "GET / HTTP/1.1", host: "omitted"I only have a simple index.html in the ~/website directory for testing purposes:
<html> <head> <title>It worked!</title> </head> <body> <h1>Did it?</h1> </body>
</html>Research has told me that if there's no issue with the files themselves, there's something wrong with the config file. Here's /etc/nginx/nginx.conf:
grep "root" -R /etc/nginx/sites-enabled will return the following:
/etc/nginx/sites-enabled/default: root ~/website;
/etc/nginx/sites-enabled/default: # deny access to .htaccess files, if Apache's document root
/etc/nginx/sites-enabled/default:# root /var/www/example.com;And here's the contents of /etc/nginx/sites-enabled/default:
sudo nginx -t returns with no errors, and I have restarted Nginx.
Please let me know if I've missed any information, and I appreciate any help.
1 Answer
You cannot use relative paths in your docroot settings. Use full paths. /home/USERNAME/website for example.