Virtual Hosts For some reason wont work

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

Re: Virtual Hosts For some reason wont work

Postby Izzy » 24. August 2009 19:12

Try this as there seems to be mixed forward and back slashes.
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
ServerName development.abba.laptop
ServerAlias laptop.abba
DocumentRoot "C:/web/projects/abba/web"
<Directory "C:/web/projects/abba/web">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
##ServerAdmin postmaster@dummy-host.localhost
CustomLog "C:/web/logs/abba/access.log" combined
ErrorLog "C:/web/logs/abba/error.log"
LogLevel debug
</VirtualHost>
Save the file after editing and then restart Apache.

Change the path in the localhost vhost to reflect your own installation path of XAMPP

If on Vista, sometimes forward slashes / have been known to play up so change them all to back slashes \.

The DocumentRoot and the <Directory> directives should both be exactly the same as should the NameVirtualHost and the <VirtualHost> directives.

URIs covered above are:
http://localhost
http://development.abba.laptop
http://laptop.abba

Make sure you add these to your C:\Windows\system32\drivers\etc\Hosts file and the first uncommented entries should look like this:
Code: Select all
127.0.0.1 localhost
127.0.0.1 development.abba.laptop
127.0.0.1 laptop.abba
Save the file after editing.


Here's a link to all the Apache Directives:
http://httpd.apache.org/docs/2.2/mod/directives.html
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Virtual Hosts For some reason wont work

Postby theskink » 31. August 2009 01:06

Hello I am new here and have a prob with 1 vhost and I dont think it is my httpd but maybe a config in a htaccess as I seem to have uknowingly resolved it at one point because the specific vhost did work for a short time when I was messing with conf files. I have 5 domains 1st and 4 name based vhosts. 3 vhost work fine and one defaults to my first "main domain" and I cant find the flub.

The offender is http://imyourhandyman.biz below is part of my vhost.conf... Rantspace works for me imyourhandyman seems to default to themoddepot.com and I cant find a prob in error or rewrite logs. anyone have a clue as to why I might be defaulting to my 1st domain???

Thanks I know that sometimes the most obvious is overlooked and a fresh set of eyes can be the answer,,, also it might be that I am calling it from the machine that has the server so if you hit the link and get a apache2 start page that means it is my browser at fault....

Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
   ServerName themoddepot.com
   DocumentRoot "H:/apache2/htdocs"
   Alias /awstatsclasses "H:/apache2/htdocs/AWStats/wwwroot/classes/"
   Alias /awstatscss "H:/apache2/htdocs/AWStats/wwwroot/css/"
   Alias /awstatsicons "H:/apache2/htdocs/AWStats/wwwroot/icon/"
   ScriptAlias /awstats/ "H:/apache2/htdocs/AWStats/wwwroot/cgi-bin/"
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@imyourhandyman.biz
    DocumentRoot H:/apache2/imyourhandyman
    ServerName imyourhandyman.biz
    ErrorLog logs/imyourhandyman.biz-error.log
    CustomLog logs/imyourhandyman.biz-access.log combined env=!dontlog
    CustomLog logs/exploit.log combined env=!exploit
<Directory "H:/apache2/imyourhandyman">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine on
</Directory>
</VirtualHost>
#
###########################################
#
<VirtualHost *:80>
    ServerAdmin admin@rantspace.info
    DocumentRoot H:/apache2/rantspace
    ServerName rantspace.info
    ScriptAlias /blogs "H:/apache2/rantspace/lifetype/index.php"
    ScriptAlias /cgi-bin "H:/apache2/rantspace/cgi-bin/"
    ErrorLog logs/rantspace.info-error.log
    CustomLog logs/rantspace.info-access.log combined env=!dontlog
    CustomLog logs/exploit.log combined env=!exploit
<Directory "H:/apache2/rantspace">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>



PS. this is not the whole vhost file...
theskink
 
Posts: 8
Joined: 31. August 2009 00:27

Re: Virtual Hosts For some reason wont work

Postby Izzy » 31. August 2009 05:31

Try DocumentRoot "H:/apache2/imyourhandyman" with the quotes.

Same applies for this directive DocumentRoot H:/apache2/rantspace

As a rule of thumb the folder in the DocumentRoot directive must be identical to the folder in the <Directory> directive.

If there is an issue with your vhosts then usually you will only have loaded the first good vhost.

Run the command apache -S in a command prompt in the \xampp\apache\bin folder (cd to this folder) and see if you can spot the errors, if not paste the whole apache -S result here.

If you have name based and IP based mixed vhosts then I usually put the IP based first followed by the name based - but usually there is only the need to use name based unless you specifically can't do any other than use IP based vhosts.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Virtual Hosts For some reason wont work

Postby theskink » 31. August 2009 07:33

Izzy wrote:Try DocumentRoot "H:/apache2/imyourhandyman" with the quotes.

Same applies for this directive DocumentRoot H:/apache2/rantspace

As a rule of thumb the folder in the DocumentRoot directive must be identical to the folder in the <Directory> directive.

If there is an issue with your vhosts then usually you will only have loaded the first good vhost.

Run the command apache -S in a command prompt in the \xampp\apache\bin folder (cd to this folder) and see if you can spot the errors, if not paste the whole apache -S result here.

If you have name based and IP based mixed vhosts then I usually put the IP based first followed by the name based - but usually there is only the need to use name based unless you specifically can't do any other than use IP based vhosts.

Some weird stuff happen today after I posted... first I called a imyourhandyman from a computer on my network and it showed the main,,, but the services showed apache 2 in a different position out of alphabetical order on the server machine... I rebooted the server machine and it asked me do I want to save vhost.conf,,, but I had saved it on the last edit,,,weird,,,but the result is the vhost domain works,,,woop...

Thanks for your quick reply and the good debug info... I am going to implement your suggestions too...
theskink
 
Posts: 8
Joined: 31. August 2009 00:27

Re: Virtual Hosts For some reason wont work

Postby theskink » 10. September 2009 21:09

Izzy wrote:Try DocumentRoot "H:/apache2/imyourhandyman" with the quotes.

Same applies for this directive DocumentRoot H:/apache2/rantspace

As a rule of thumb the folder in the DocumentRoot directive must be identical to the folder in the <Directory> directive.

If there is an issue with your vhosts then usually you will only have loaded the first good vhost.

Run the command apache -S in a command prompt in the \xampp\apache\bin folder (cd to this folder) and see if you can spot the errors, if not paste the whole apache -S result here.

If you have name based and IP based mixed vhosts then I usually put the IP based first followed by the name based - but usually there is only the need to use name based unless you specifically can't do any other than use IP based vhosts.


OK new developement... I can only get http://imyourhandyman.biz from the other machines on the network not from the host machine... I am thinking it might be a network config now,,, but that is a guess... below is the command you prescribed,,, looks good to me but IDK if the default machine is also a vhost as stated in the command prompt... IDK if this is even a problem as it may be ok to the outside world,,, but it will be tough building a site haveing to go to another machine to check edits...

PS... I did implement all your directions with success... I have no prob viewing my other vhosts,,, they are cgi-bin forums as imyourhandyman is just a simple index.html page in the root...

Code: Select all
H:\apache2\apache\bin>apache -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443          localhost (H:/apache2/apache/conf/extra/httpd-ssl.conf:74)
*:80                   is a NameVirtualHost
         default server themoddepot.com (H:/apache2/apache/conf/extra/httpd-vhosts.conf:38)
         port 80 namevhost themoddepot.com (H:/apache2/apache/conf/extra/httpd-vhosts.conf:38)
         port 80 namevhost tokingbuds.com (H:/apache2/apache/conf/extra/httpd-vhosts.conf:166)
         port 80 namevhost cannabis-zone.com (H:/apache2/apache/conf/extra/httpd-vhosts.conf:271)
         port 80 namevhost imyourhandyman.biz (H:/apache2/apache/conf/extra/httpd-vhosts.conf:346)
         port 80 namevhost rantspace.info (H:/apache2/apache/conf/extra/httpd-vhosts.conf:364)
Syntax OK


Here I am addin my HOST$ file
Code: Select all
127.0.0.1 localhost
192.168.1.31 localhost
192.168.1.30 localhost
#
#
76.189.106.97 themoddepot.com # source server
76.189.106.97 www.themoddepot.com # source server
76.189.106.97 tokingbuds.com # x client host
76.189.106.97 www.tokingbuds.com # x client host
76.189.106.97 cannabis-zone.com # x client host
76.189.106.97 www.cannabis-zone.com # x client host
76.189.106.97 imyourhandyman.biz # x client host
76.189.106.97 www.imyourhandyman.biz # x client host
76.189.106.97 rantspace.info # x client host
76.189.106.97 www.rantspace.info # x client host


Thanks,,, I love Xammp...
theskink
 
Posts: 8
Joined: 31. August 2009 00:27

Previous

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 128 guests