Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer

Apache has a feature that allows for per user web directories which lets people access your files using http://www.example.com/~mark/

You could combine this with the symlink idea

cd 
ln -s zip public_html

or

cd
mkdir public_html
cd public html 
ln -s ../zip zip

I think you need to tell Apache to follow symlinks.

You also need to set permissions on the directories and files so they are readable by the user under which Apache runs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.