Flippin Sweet Dude

October 26, 2009

Simple Download Setup

Filed under: Linux — aaron @ 12:01 pm

Here is some simple steps to give you a filedownloads.yourdomain.com feature to share files with others.  This example is for Debian setup, but can easily be ported over for other linux flavors.

Setup folder in your home directory:

mkdir /home/yourname/filedownloads

add index.php file to it:  ( from here )

<?
$filepath = “/home/yourname/filedownloads/”;
$dir_handle = @opendir($path) or die(“Unable to open your  $filepath”);
while ($file = readdir($dir_handle))

{
if($file == “.” || $file == “..” || $file == “index.php” )
continue;
echo “<a href=\”$file\”>$file</a><br />”;
}
closedir($dir_handle);
?>

append to apache setup file at /etc/apache2/sites-available/default

#  public file download
<VirtualHost *:80>
DocumentRoot /home/yourname/filedownloads
ServerName filedownloads.yourdomain.com
</VirtualHost>

Restart apache daemon

/etc/init.d/apache restart

Everything you put inside the folder /home/yourname/filedownloads will now show up as a link on the web under filedownloads.yourdomain.com.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress