apache – grant access to single file

Steps

  1. Ensure target file has read access from apache user
    ls -l /path/to/my/file/myfile.doc

    If not, grant right via:

    chmod a+rwx /path/to/my/file/myfile.doc
  2. In one of your /etc/apache/sites-enable/*.conf files, add the following:
    <Directory /path/to/my/file>
    <Files myfile.doc>
    Require all granted
    </Files>
    </Directory>
    
  3. Restart apache
    sudo apache2ctl restart

Voilà!

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...