Page 1 of 1

Virtual Hosts not working

PostPosted: 23. October 2008 15:37
by Nightshade
I have XAMPP 1.6.5

I have an external drive which I use to store website files. I try to set this up as a virtual host in httpd-vhosts.conf with these lines:

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "Y:\Work"
    ServerName shareddrive
</VirtualHost>


However with these lines in my vhosts file I get the following error when starting Apache: "Apache HTTP Server has encountered a problem and needs to close. We are sorry for the inconvenience."

If I remove these lines from the vhosts file I don't get the error when starting Apache.

Why can't I set up my external drive as a virtual host?!

PostPosted: 23. October 2008 15:55
by Wiedmann
This external drive is connected?

(BTW: use forward slashs)

PostPosted: 23. October 2008 17:25
by Nightshade
Yes the external drive is connected and is accessible through My Computer with the Y: drive letter.

I tried using forward slashes but still get the crash/error

PostPosted: 23. October 2008 17:30
by Wiedmann
when starting Apache

How did you start Apache?

PostPosted: 23. October 2008 17:58
by Nightshade
Apache isn't running from startup so I goto XAMPP Control Panel and click Start on Apache. When I have a blank httpd-vhosts.conf it runs within a few seconds and has a green "running" text next to Apache. With my external drive set up in the vhosts file I get the error message.

PostPosted: 23. October 2008 18:53
by Wiedmann
I goto XAMPP Control Panel and click Start on Apache.

Is "Svc" checked or not?

PostPosted: 24. October 2008 02:20
by Sharley
You may also have to set access permissions for the folder Work as the defaults in the httpd.conf file are restrictive and only allow access to the htdocs tree unless overridden in your vhost container.

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName shareddrive
DocumentRoot "Y:/Work"
<Directory "Y:/Work">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The error message in the .\xampp\apache\error.log would possibly be 403 Access Denied if permissions are not set for a given folder outside of the htdocs tree.

PostPosted: 24. October 2008 09:52
by Nightshade
Thinking that the external drive was causing the problems I moved the files to another Windows XP computer on my network. I mapped the network drive to X:/ in Windows, however XAMPP still won't work with it. (I will be using X:/ now and not Y:/Work though).

I tried uninstalling XAMPP and installing a fresh install of XAMPP 1.6.8 to see if that would help, no luck same problem. All I did to modify the 'stock' installation was add this to httpd-vhosts.conf:

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
   ServerName shareddrive
   DocumentRoot "X:/"
</VirtualHost>


I also tried this (but no luck either):

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
   ServerName shareddrive
   DocumentRoot "X:/"

   <Directory>
      Options Indexes +FollowSymLinks Includes ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>

</VirtualHost>


Sharley I think you missed a '>' at the end of the Directory tag?

I checked Apache's error log but no mention of a 403 error in there.

One more thing. I have "127.0.0.1 shareddrive" in my hosts file. Is this right? Should this be the IP address of the network drive instead?

PostPosted: 24. October 2008 09:58
by Nightshade
Oh and I also tried the above with:

Code: Select all
<Directory "X:/">