I am new to apache and linux ( 3 months ) and started a home server, I would like to serve my documents in .pdf and .mp4 video of my own solved maths/physics solution via apache 2 residing on the external HDD to anybody.

Everything went okay but by clicking the download link of the website page, Apache just try to play that file and then if one tries to save the file with right click then only 250 bytes are downloaded with complete filename.

The 2 Qs are:

1: I want that the left click will enable the downloading instead of playing.

2: I want to enable the complete download instead of just 250 bits.

I have Ubuntu 14.04 and apache2. The main config. file is apache2.conf in /etc/apache2 folder.

If I put the pdf or mp4 file in the folder /var/www/html/ then the complete file is downloaded without problem but the ubuntu 14.04 installation HDD is just 100 GB and I want to use a esata 2TB external HDD for the serving files. The external HDD is mounted on startup.

The website is one of the few websites I am running as virtual host.

about 250 bytes when opened with gedit shows this message

!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> html> title>404 Not Found /head> h1>Not Found p>The requested URL XYZ(where XYZ is the path of the file on external HDD) was not found on this server.

it is strange as when right click and save from the browser, it shows the complete path of the file and it indeed download the filename and the 250 bytes contains the message as above.

Can someone help me out please? or even point me to the right direction.

The few websites are running from the dir var/www/html without any problem. I just want to enable downloads or you can say uploads. The permission of the external HDD is www-data and the permission of var/www/html/xyz-website.com is also www-data.

Any help is appreciated and if its off topic then plz point me to the right topic.

About the mount point of the external HDD PLZ see my comment below. So how would i mount the external HDD to the subfolder of the var/www/html ? or how would i make the virtual document root? any link is very appreciated. THX

  • Concerning Q1, this has nothing to do with the Apache server, but rather with the client's browser configuration. For instance, in Firefox under Preferences -> Applications you can choose what should happen if you left-click on a link that serves a certain file type, such as a PDF document or an MPEG-4 video. Concerning Q2, this indeed sounds like some weird eSATA problem, though I am not sure it is related to Apache. Can you normally access and read the entire file from your external drive using other software, e.g., from the terminal? – Malte Skoruppa Aug 28 '14 at 12:49
  • For Q2: have you looked at those 250 bits? Are they indeed the first 250 bits of the file you are trying to download? It may be that this is just some constant error message, telling you for example Apache cannot access that file (though 250 bits sounds like too little; sure it isn't 250 bytes?). Then, it may just be a permission problem. Where do you mount that external HDD, and can the user www-data access the files mounted there? – Malte Skoruppa Aug 28 '14 at 12:54
  • Sorry...it is about 250 bytes and when opened with gedit they are<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL XYZ was not found on this server.</p> </body></html> – Mos Aug 28 '14 at 14:32
  • Okay, installed Google chrome and it says " the requested URL is not found on this server " and right click and save shows the filename but save gives an error " failed to download ". IMO there is something with the DocumentRoot and permissions but I am unable to move any further without any hint. PLZ hints wanted. – Mos Aug 28 '14 at 15:12
  • 1
    Ok, so the answer to Q2 is this: Apache simply does not find your files on the external hard drive. Where do you mount it? You will need to configure Apache to (1) allow it to access that location (also make sure permissions are correct) via some <Directory> directive, or else mount your external drive directly somewhere into /var/www and (2) probably define some kind of <Alias> directive to link certain URLs to this directory (except if you mount your external HDD to a subfolder of /var/www anyway, that would probably be the easiest solution) – Malte Skoruppa Aug 28 '14 at 15:14

Thanks Malte for the hint....the problem is solved with mounting the external HDD in the subdirectory of the actual website e.g var/www/html/mywebsite/1(partition-1) and same for the partition 2 and 3. The whole external 2TB HDD is now mounted under the sub-dir of the actual website.

As Matlle said........this is the easiest sol. No need for fiddling with DocumentRoot or Alias etc just edit fstab and thats it. It will work for external USB or eSATA. I will try external USB too in another virtual host and post my finding soon.

Since mine is a free website and I have no problem with ppl browsing my HDD so the problem is solved with Malte's hint and this link for mount points.


why should I not love linux?

I was a complete zero in linux and apache 3 months ago and now I have removed windows from every PC.

Since I am new to Ubuntu/linux so I will soon make a step by step guide intended for the new-bees to start their own websites in layman's terms.

Thank you all and specially Malte. Problem became clear after I saw the 250 bytes in gedit.

  • Cool! I'm glad I could help. Yes indeed, Linux is just great. I wish you a lot of more fun with it, and do not hesitate do post more questions or even Q&A's here :) – Malte Skoruppa Aug 29 '14 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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