Need some help with VHOSTS and APACHE using XAMPP on Windows

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Need some help with VHOSTS and APACHE using XAMPP on Windows

Postby benjamin.cramphorn » 14. September 2010 20:41

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?
benjamin.cramphorn
 
Posts: 2
Joined: 14. September 2010 20:39

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

Postby JonB » 15. September 2010 03:34

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)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

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

Postby benjamin.cramphorn » 15. September 2010 17:48

Ah that works.

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

Thanks a lot!

B
benjamin.cramphorn
 
Posts: 2
Joined: 14. September 2010 20:39


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 62 guests