Using Apache2 to Store Files for Accessing with wget?

Hello All,

I have a Virtual Machine that I basically use for just testing stuff on. It is running SLES 11.1 and Apache2.

I was able to get Apache2 set-up and working... I was able to insert a basic index.html page (i.e. a simple "Hello World" html page)
just to check and make sure I can access it from my local machine in Firefox. Which does work...

I wanted to see if there was a way I could say create a directory, i.e. "/srv/www/htdocs/docs" and insert files in there that I would
like to share with my local machine. Then from my localhost be able to issue a: (for example the server's IP is 192.168.2.2)

# wget http://192.168.2.2/docs/myFile_I_want.txt

Could anyone tell me if this is possible..?
Any suggestions would be much appreciated!

Thanks in Advance,
Matt

That should work as long as the webserver has read access.

Hey hergp, thanks for the reply!

Yea I got it working like minutes before I left work yesterday evening...
I had everything correct except I was missing somehting in the "/etc/apache2/httpd.conf" file.

Here's the Section I added to my httpd.conf Config File:

DocumentRoot /srv/www/htdocs

<Directory "/srv/www/htdocs/docs">
    Options Indexes
    Order allow,deny
    Allow from all
</Directory>

Seems to be working perfectly now...

Do you know if the section above in the "Allow from ..." line, can I insert a list of IP Addresses in
order to narrow down who can have access to the files...?

Thanks Again,
Matt

---------- Post updated at 10:19 AM ---------- Previous update was at 10:06 AM ----------

I had one other question besides the one about adding a list of IP Addresses to the "Allow from" line
of the httpd.conf file...

I created symbolic links to the files I wanted to be made available and it seems to be working just fine. I then
tried adding a symbolic link to a directory in the "/srv/www/htdocs/docs" but it doesn't seem to work (i.e. it's not
showing in the browser)?

Is this the expected behavior, or is there some kind of option I can add to one of the configs that would allow this..?

Thanks in Advance,
Matt

First question -- access restrictions. Let's say, you want only to allow users in the 192.168.1.* and 192.168.3.* network:

Order deny,allow
Deny  from all
Allow from 192.168.1.0/24
Allow from 192.168.3.0/24

I'm not sure about the symlinks, but I think they must not point outside of the directory where they are created.

Hey hergp, thanks again for the reply!

Cool, thanks I'll get those IP Address' subnets in there, thanks!

As for the symlinks, I found an Option for the "Directory" section in my httpd.conf file that will allow the use of "Symlinks".
The Option is called "FollowSymLinks" and it works perfect now...

Here's my modified "Directory" section in "httpd.conf":

 <Directory "/srv/www/htdocs/docs/">
    Options Indexes FollowSymLinks MultiViews
    # Will be adding an "Allow" section below to control who can access the files at in this directory...
    Order allow,deny
    Allow from all
 </Directory>

Well, thanks again hergp for your help, much appreciated!!

Thanks Again,
Matt

1 Like