Sharing Files Using Apache

Apache is pretty useful for sharing files on network particularly on LAN. Here is how to map an external folder to an url on your apache server. Lets assume your user name as bob and the path of the folder that you want to share is /home/bob/downloads. And you want to access contents of this folder at url /downloads.

Change directory to /etc/apache2/sites-enabled. And create file named downloads with the following contents.

Alias "/downloads" "/home/bob/downloads"
<Directory "/home/bob/downloads">
    AllowOverride None
    Options Indexes
    Order allow,deny
    Allow from all
</Directory>

Save the file and close it. Now restart the apache by issuing following command.

sudo apache2ctl restart

Now test everything is working as expected by going to following url in your browser.

http://localhost/downloads

3 comments:

NDog said...

Hi there, good article, however I put a file in the folder and it says

Forbidden
You don't have permission to access /pub/GPL.html on this server.

The permissions of the folder are full access, i used the chmod 777 to the folder, however still no luck.

Any hints?

Anonymous said...

Hi there,

same shit here.

Forbidden

You don't have permission to access /share/ on this server.

--
m

Anonymous said...

Just put the folder you want to share inside the /var/www/ folder.