-   Linux - Software (
-   -   Configure apache to use windows share as webroot ? (

fuzioneer 02-02-2009 10:31 AM

Configure apache to use windows share as webroot ?
I have a soho network with a NAS box, sbs2003 server, centos5.2 dev server and multiple clients

The centos server is a recent addition and I wanted to configure it so that one of the shares on my server "web" is the webroot somehow on apache so that any sites i am doing Dev work on can be browsed locally to test before uploading to live server elsewhere.

I can do basic nix admin work and sysadmin a couple of servers but have a friend who is more a guru than I if needed to help me out lol

I have apache installed and up and running with default install
I have access to the shares from the centos box and can see the content accessed over my domain on \\mydomain\myserver\web

below this share are multiple sites I run fileroots, it would be superb if I could create a virtual host for each site so that i can access all sites locally.

Any pointers on this when configuring apache ?

i.e. what do i put for Document root directory ?

jimvin 02-03-2009 02:56 AM

You will want to mount the windows share on the centos server.

mount -t smbfs //servername/sharename /mountdirectory -o <options>

Depending on how you have the share set up you may need to provide the username, password and domain to access the share. Once the share is mounted it will looks like any other part of the file system and you can set this as you document root.

You can use the Alias directive in Apache to create the references to each document root you have on the share e.g.

Alias /work /mnt/smb/my_work
Alias /mp3 /mnt/smb/music

Check out the apache documentation for mod_alias for more information. The apache docs are good and well worth a read.


fuzioneer 01-12-2010 04:38 PM

Well its been a while but I have revisited configuring this

I have got some way to getting it working but still have issues

i have samba running on the nix server and a windows share of \\mydomaincontroller\websitename

I have an entry in /etc/fstab as follows:-

//mydomaincontroller/websitename /mnt/Websites/websitename cifs user,uid=500,rw,suid,username=myuser,password=mypassword 0 0

this works in that i can now cd to /mnt/Websites/websitename and can view the files within

I have an entry in the httpd.conf as follows:-
<Directory "/mnt/Websites/mywebsitename">
Options Indexes Includes FollowSymLinks
AllowOverride None
Allow from all
Order allow,deny

I can fire up a browser on my pc and enter in and i get a blank white page, i have a few test html files in the mywebsitename root folder but again if i try and view these in my browser all i get is a blank page, if i view source it is empty

This would make me think its a permissions issue

if i list the files in the /mnt/Websites folder i see the mywebsitename folder and it is owned by the uid 500 user account with group of root and 777 permissions, the files within the mywebsitename folder are the same

any pointers much appreciated ??

jimvin 01-13-2010 02:54 AM

Hi there,
There are a number of possible reasons for the files not showing up. Have you checked the apache error logs? There may be a useful message as to why it's not working. If your DocumentRoot set to /mnt/Websites? If not have you added an Alias for this directory?


fuzioneer 01-13-2010 04:33 AM

turns out it was selinux blocking access ;)

jimvin 01-13-2010 04:59 AM

Well spotted! How did you work this out, it might help other users with the same problem.


fuzioneer 01-13-2010 05:03 AM

tail -f on the messages log file whilst trying to access the website via browser

fuzioneer 01-13-2010 03:41 PM

hmmm i thought I had cracked it but found another issue

I can see my site when i browse it but many things are missing like logo, css file hasn't been inserted etc

If i try and browse direct to a single image like http://mywebserver/logo.gif then I get a 200 showing in access log but the browser doesn't display the image


fuzioneer 01-14-2010 05:13 AM

Well i have checked everything and can't suss it at all

selinux is disabled

full permissions granted to everyone on the windows share and files

i have tried different variations on the mounted file / folder permissions

but some images do display properly but not all !!!

All times are GMT -5. The time now is 01:31 PM.