I am running a local testing server on my laptop running Ubuntu 16.10. I was running Apache2, but I've decided to switch over to NginX. Following guides like this one, I think I've got NginX up and running, along with PHP 7.0 fpm.
However, when I load one of my sites, I get a 403 Forbidden error
. The NginX error log says :
[error] 14107#14107: *1 directory index of "/var/www/example.com/" is forbidden, client: 127.0.0.1, server: example.com, request: "GET / HTTP/1.1", host: "example.com"
I understand that all the parent directories in the path should have the right permissions, but I'm unclear on exactly what the correct permissions are. If I understand correctly, under Apache2, the directories were accessible to the user or group www-data
, but I'm not sure if that's still true under NginX.
What chmod
or chown
command should I be using to ensure that the relevant directory has permissions that will make it accessible to NginX? Note that I am completely replacing Apache2 with NginX, so there is no need to preserve any settings for Apache's sake.
Also, for reference, here is the current directory path and permissions of my site. Note that the directory in /var/www
is a symlink to a directory in my Dropbox folder, if that has any impact.
$ namei -om /var/www/example.com
f: /var/www/example.com
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x www-data www-data www
lrwxrwxrwx www-data www-data example.com -> /home/user/Dropbox/subdir1/subdir2/Site/
drwxr-xr-x root root /
drwxr-xr-x root root home
drwxr-xr-x user user user
drwx--x--x user user subdir1
drwxrwxr-x user user subdir2
drwxr-xr-x user user Web
drwxr-xr-x user user Site