Ubuntu – How to give Apache access to files in the home directory

apache-http-serverpermissionsUbuntu

I'm a Ubuntu Linux user (Lucid Lynx) who is running Apache. I have a collection of zip files in a folder in my home directory (~/zip_files) which I would like to be able to link to through apache, such that when somebody who visits my website which I'm using Apache to host clicks a link to one of the zip files, he can download it through the web. How can I provide Apache with access to the files and set the permissions? Thanks, I'm new to linux!

Best Answer

There are two approaches that you can take:

  1. Change the DocumentRoot in your Apache conf file to your home directory. This will immediately serve your documents across HTTP. You will need to reload Apache to see the change.

  2. The second approach is to use a symlink. Symlinks are essentially references to other files or folders. In the directory /var/www type:

    ln -s /var/www /home/username
    

    This is a good description of symlink. You will still need to set the FollowSymLinks option in the Apache conf and reload Apache.

For both approaches, make sure that the folder permissions are at least 755 (use chmod 755 /home/username) to ensure the permissions are correct.

Related Question