Page 1 of 1

Need some help with VHOSTS and APACHE using XAMPP on Windows

PostPosted: 14. September 2010 20:41
by benjamin.cramphorn
Set up a small webserver using XAMPP.

I'm now trying to get used to using V-HOSTING.

= My document root is set to C:/WebServer/xampp/htdocs

= I have edited my hosts file so that www.test1.com and www.test2.com are directed to 127.0.0.1 (localhost).

= htdocs contains 2 folders test1 and test2

This is how I currently have my vhost entry set up...

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.test1.com
DocumentRoot /test1
</VirtualHost>

<VirtualHost *:80>
ServerName www.test2.com
DocumentRoot /test2
</VirtualHost>

However I keep on getting "You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. "

I assume the vhost entries are correct?

I guess firstly I want to make sure I have my document root part in the vhost entry correct.

If my apache document root = C:/WebServer/xampp/htdocs then the vhost entry just needs the sub directories of that right?

Re: Need some help with VHOSTS and APACHE using XAMPP on Windows

PostPosted: 15. September 2010 03:34
by JonB
A. the vhost DocumentRoots need to be full pathnames (just like the one for the original htdocs)

B, Vhosts really shouldn't be nested inside another host. (It will work - BUT - the contents of the vhosts are also part of the 'root' default host. (as they are below its document root). A vhost is really a separate webserver, when you place a folder under a DocumentRoot, its part of that server's 'webspace'.

C. the first vhost should be a 'duplicate' of the original install (see the notes in the xammp\apache\conf\extra\httpd-vhosts.conf file.)

here's what a 'correct/working' vhost entry looks like:

Code: Select all
<VirtualHost *:80>
    ServerAdmin jb@newnet.tld
    DocumentRoot "C:/xampp/sites/ml.newnet"
    ServerName ml.newnet.tld
    ##ServerAlias ml.newnet.tld
    ErrorLog "logs/ml_bravo-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
</VirtualHost>
Good Luck
8)

Re: Need some help with VHOSTS and APACHE using XAMPP on Windows

PostPosted: 15. September 2010 17:48
by benjamin.cramphorn
Ah that works.

I didn't quite understand all of what you said but it's working!!!!

Thanks a lot!

B