title: What are the correct permissions for my site that is now served by NginX?
body: <p>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 <a href="https://www.digitalocean.com/community/tutorials/how-to-migrate-from-an-apache-web-server-to-nginx-on-an-ubuntu-vps" rel="nofollow noreferrer">this one</a>, I think I've got NginX up and running, along with PHP 7.0 fpm.</p>
  
  <p>However, when I load one of my sites, I get a <code>403 Forbidden error</code>. The NginX error log says :</p>
  
  <pre><code>[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"
  </code></pre>
  
  <p>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 <code>www-data</code>, but I'm not sure if that's still true under NginX.</p>
  
  <p><strong>What <code>chmod</code> or <code>chown</code> command should I be using to ensure that the relevant directory has permissions that will make it accessible to NginX?</strong> Note that I am completely replacing Apache2 with NginX, so there is no need to preserve any settings for Apache's sake.</p>
  
  <p>Also, for reference, here is the current directory path and permissions of my site. Note that the directory in <code>/var/www</code> is a symlink to a directory in my Dropbox folder, if that has any impact.</p>
  
  <pre><code>$ 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 -&gt; /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
  </code></pre>