title: Nginx - alias for directory but return 403 for /
body: <p>Here's a part of my Nginx configuration:</p>
  
  <pre><code>server {
    location /f/ {
       autoindex on;
       alias /ftp/;
     }
  }
  </code></pre>
  
  <p>When I go to <code>www.mywebsite.com/f/foo.txt</code>, it returns the file if it exists in <code>/ftp/</code> or a 404 error if it doesn't.</p>
  
  <p>When I go to <code>www.mywebsite.com/f/</code>, it lists all files in <code>/ftp/</code> directory.</p>
  
  <p>Would there be any way return a 403 error instead of listing all files?</p>
  
  <p>Thanks.</p>