Link to home
Start Free TrialLog in
Avatar of AbdellahT
AbdellahT

asked on

Apache 2 serving files on external drive

Hi guys,

I need Apache to serve a huge number of pdf files that live on a NETWORK STORAGE (exteranl drvie)
I want to be able to view each file using http://host/files/file.pdf 
I am using windows 2003.
from what I understand I need to create a virtual host that its root directory is the exteranal media . is this correct?
Please advise the best way to accomplish this?

Thanks
Abdellah

Avatar of ericnils
ericnils

Go to c:\<where apache is installed>\sites-enabled\

Create a new text file with a virtual host entry like the one below:

<VirtualHost *:80>
ServerName remotefiles.host.domain.com
DocumentRoot <path to files>
</VirtualHost>

I'm assuming you are already serving some content on this server.  If that is the case you will have to create a DNS alias such as remotefiles.host.domain.com so that apache will know which virtual server to access by the URL in the query (the servername variable above).

Once you've done this you will have to restart apache to make the changes visible.
Avatar of AbdellahT

ASKER

I just made a fresh apache 2 install. I am not serving any pages yet. this is my first task to do.  
You mean create the text file under htdocs? if so how to include it in httpd.conf?
Thanks a lot.
Abdellah
htdocs is probably your default document root.  The sites-enabled folder is inside of your apache installation, probably program files or something.  Files in sites-enabled will be included in the apache configuration when it loads.

If you don't ever plan to serve more than one site from this server then you can just change your default document root by following steps 5 & 6 here: http://www.ricocheting.com/server/apache.html and that should take care of everything for you.  

Be aware that regardless of how you configure this you may run into issues with files that contain non-valid URL characters such as & and ,.
That's probably what I am going to do, I will just change the DocumentRoot to point the extranal drive directory. Thanks a lot.
Question: how to restrict directory browsing ?
 
Thanks
Abdellah
ASKER CERTIFIED SOLUTION
Avatar of ericnils
ericnils

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial