apache vitual host

GV7

GV7

Associate
Joined
20 Oct 2002
Posts
71
Hope someone can help after 3days i give up.
Can virtual hosts point to different drives or do they doc roots have to be inside the main doc folder.
ie what i was after

<virtualhost *:80>
DocumentRoot "D:/stuffinhere1"
ServerName www.nickname.dyndnsname.net
</virtualHost>

<virtualhost *:80>
DocumentRoot "E:/stuffinhere2"
ServerName www.wildcard.nickname.dyndnsname.net
</virtualHost>

<virtualhost *:80>
DocumentRoot "F:/stuffinhere3"
ServerName www.wildcard.nickname.dyndnsname.net
</virtualHost>

or does it have to be like this to work

<virtualhost *:80>
DocumentRoot "D:/stuffinhere1"
ServerName www.nickname.dyndnsname.net
</virtualHost>

<virtualhost *:80>
DocumentRoot "D:/stuffinhere1/stuffinhere2"
ServerName www.wildcard.nickname.dyndnsname.net
</virtualHost>

<virtualhost *:80>
DocumentRoot "D:/stuffinhere1/stuffinhere3"
ServerName www.wildcard.nickname.dyndnsname.net
</virtualHost>




Also in the <Directory> and <DocumentRoot> in httpd.conf do you have to have this pointing to the main folder ie "D:/stuffinhere" as when i comment it out nothing seems to work.

I maybe going about this the wrong way but what i am eventually after is a folder with a website in it running a shared calender that the family can access from anywhere to update and the ability to get at any of my movies/music/software from anywhere i am. For calendar i was going to use webclandar form webcalendar.sourceforge.net.

cheers for any pointers
 
Last edited:
I don't see anything wrong, except that you spelt DocumenRoot without a 't' :)
Having different DocumentRoot's in each VirtualHost on seperate drives should be fine, but you may have to specify a Directory directive to set permissions for each one so that they are viewable (if you're getting 403 permission denied errors).

Are you getting an error when starting Apache, or while it's running, or just not working how you expect?
 
Hi matja
Can't see the missing "t" i must be going blind.
Anyway if i have it as in the first example i can get to
stuffinhere1 using www.nickname.dyndns.net

using name with wildcard for stuffinhere2 and 3 i get this error.
HTTP Error 403 - Forbidden
Internet Explorer

now this is with the following set below
DocumentRoot "D:/stuffinhere1"
<Directory "D:/stuffinhere1">

if i change above and swap stuffinhere1 for stuffinhere2 then www.nickname.dyndns.net now gets me the error HTTP Error 403 and
www.wildcard.nickname.dyndns.net gets me to stuffinhere2

so i am thinking it is some thing to do with the DocumentRoot and <Directory> as in somehow having DocumentRoot "D:/stuffinhere1 E:/stuffinhere" etc but i tried that and apache would not start.

hope i am making sense.

:D :D just noticed it DocemenRoot, will change it.
 
Last edited:
just discovered this but not sure how to go about it in windows.

top
DocumentRoot

In deciding what file to serve for a given request, Apache's default behavior is to take the URL-Path for the request (the part of the URL following the hostname and port) and add it to the end of the DocumentRoot specified in your configuration files. Therefore, the files and directories underneath the DocumentRoot make up the basic document tree which will be visible from the web.

Apache is also capable of Virtual Hosting, where the server receives requests for more than one host. In this case, a different DocumentRoot can be specified for each virtual host, or alternatively, the directives provided by the module mod_vhost_alias can be used to dynamically determine the appropriate place from which to serve content based on the requested IP address or hostname.
 
Try adding :
<Directory "<driveletter>:/path">
Order allow,deny
Allow from all
Options +Indexes
</Directory>

inside each virtualhost, that should let you access them.
 
sorry majta did not even see your reply up there do you mean like this

<virtualhost *:80>
DocumentRoot "E:/stuffinhere2"
ServerName www.wildcard.nickname.dyndnsname.net
<Directory "E:/stuffinhere2">
Order allow,deny
Allow from all
Options +Indexes
</Directory>
</virtualHost>

[is it "E:/stuffinhere2"> or "<E>:/stuffinhere2">
 
Last edited:
firefox gives the error
Forbidden


You don't have permission to access / on this server.



Although i have not put the directory in the virtual host yet as i am not sure how to do it.
 
matja
Just to say thanks, tried putting your code in again and the server started and i could access the files. Had to change a few things as i wanted it password protected which i did not mention to you so i put this in.
<Directory "F:/stuffinhere3">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Only one minor thing now, maybe you can tell me if that's the way it has to be or there is something i can alter.
www.nickname.dyndns.net= stuffinhere1
nickname.dyndns.net= stuffinhere1

www.wildcard2.nickname.dyndns.net= stuffinhere1
but wildcard2.nickname.dyndns.net = stuffinhere2 which is what i am after, just wondering when i add www. to the start of the wildcard name it goes to the default folder, but when i leave out the www. it goes to the correct folder.

Any pointers to this.

if not cheers anyway for the main bit of help.
 
Back
Top Bottom