Virtualhost problem

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

Virtualhost problem

Postby pitvenin » 06. August 2011 10:58

Hello to all

I've been having a stressing problem for the past days now..
I've been trying to make a virtual host on my machine (I have Windows 7 Professional) but I can't get it to work. Here is how I have it setup :
Code: Select all
<Directory "F:\flash projects\gallery">
   Options +Indexes +Includes +ExecCGI +FollowSymLinks
   AllowOverride All
   Order deny,allow
   Allow from all
</Directory>

<VirtualHost *>
   DocumentRoot "C:\xampp\htdocs"
   ServerName localhost
</VirtualHost>
 
<VirtualHost *>
   DocumentRoot "F:\flash projects\gallery"
    ServerName gallery.local
</VirtualHost>


localhost works, but gallery.local doesn't. Now if I change them and say I put at "localhost" DocumentRoot this -> "F:\flash projects\gallery" it works. I have in

"c:\windows\system32\drivers\etc\hosts" and also in "c:\windows\system32\drivers\etc\lmhosts.sam"
127.0.0.1 gallery.local

I've putted it in lmhosts.sam because I read in some site that it needs to be there in order for me to be able to ping gallery.local, witch is true, if it's not there there's no ping to gallery.local.

But this dosen't make gallery.local load in browser.
For 3 days I've been trying to find a solution...
If anyone has an idea on why the hell won't it work, please help me!
pitvenin
 
Posts: 6
Joined: 06. August 2011 10:47

Re: Virtualhost problem

Postby Sharley » 06. August 2011 12:26

Try this and after reading below about the folder name change you could copy and paste the code into your httpd_vhosts.conf file - remember to save the file and restart Apache after editing.
Code: Select all
NameVirtualHost *:80

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

<VirtualHost *:80>
ServerName gallery.local
ServerAlias www.gallery.local
DocumentRoot "F:/flash_projects/gallery"
<Directory "F:/flash_projects/gallery" >
Options +Indexes +Includes +ExecCGI +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerAdmin admin@gallery.local
</VirtualHost>
Rename the above folder so it does not have a space or you may find that you have more issues in the future as Apache and MySQL don't like spaces in file/folder names.
You can add an underscore or simply rename and remove the space, the choice is yours.

The first 2 lines in the Windows hosts file should look like this
Code: Select all
127.0.0.1 localhost
127.0.0.1 gallery.local


You would type in your browser for the above 2 items:
http://localhost/
http://gallery.local/
http://www.gallery.local

Perhaps you should have posted here sooner. :)
Good luck.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Virtualhost problem

Postby pitvenin » 08. August 2011 07:20

Still not working..:(
But here's something, in windows hosts file if I put 127.0.0.1 localhost, "localhost" will no longer load in the browser, and this is how my hosts file looks :
Code: Select all
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1 gallery.local
pitvenin
 
Posts: 6
Joined: 06. August 2011 10:47

Re: Virtualhost problem

Postby vistazifta » 08. August 2011 13:53

your localhost is marked out try changing it from this
Code: Select all
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1 gallery.local

to something like this
Code: Select all

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
#   ::1             localhost
127.0.0.1 gallery.local


usually works for me
vistazifta
 
Posts: 2
Joined: 08. August 2011 13:30

Re: Virtualhost problem

Postby pitvenin » 08. August 2011 17:32

in windows hosts file if I put 127.0.0.1 localhost, "localhost" will no longer load in the browser


If I do that http://localhost no longer loads.
pitvenin
 
Posts: 6
Joined: 06. August 2011 10:47

Re: Virtualhost problem

Postby JonB » 08. August 2011 18:20

If I do that http://localhost no longer loads.


Did you create a default VirtualHost (as is suggested in the sample file) Without that, I don't think localhost works any longer... :shock:

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: Virtualhost problem

Postby pitvenin » 08. August 2011 18:57

Yes, I did, of course I did... :|

localhost works, no problem...as long as I don't put "127.0.0.1 localhost" in hosts. That is what I'm trying to point out, Shouldn't it work even if I put "127.0.0.1 localhost"??. Btw I'm using Windows 7 Professional....
pitvenin
 
Posts: 6
Joined: 06. August 2011 10:47

Re: Virtualhost problem

Postby JonB » 08. August 2011 20:02

Could be IPv4 is disabled???

I'd suggest test pinging localhost, with the 127.0.0.1 entry active in the hosts file.

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: Virtualhost problem

Postby pitvenin » 08. August 2011 20:36

ipv4 is enabled, ping localhost gives replies, ping gallery.local gives replies only if the entry "127.0.0.1 gallery.local" is in both hosts file and lmhosts.sam
pitvenin
 
Posts: 6
Joined: 06. August 2011 10:47

Re: Virtualhost problem

Postby JonB » 08. August 2011 21:00

"127.0.0.1 gallery.local" is in both hosts file and lmhosts.sam


I'm also quite unsure why you have included entries in the lmhosts file, as that only affects NetBIOS resolution (it uses the ARP protocol). Are you using a Windows share mapped to these locations???
I'm pretty sure lmhosts.sam is a sample file anyway. I'm pretty sure the 'real file' is just 'lmhosts'. Its used to disambiguate/control IP addresses on peer-to-peer Windows networks.
http://support.microsoft.com/kb/101927

OTAY then and be that as it may - well, it would probably work better if it were in the right order (how did I miss that) :oops:
http://vlaurie.com/computers2/Articles/hosts.htm

127.0.0.1 localhost
127.0.0.1 gallery.local

:shock:

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: Virtualhost problem

Postby pitvenin » 09. August 2011 09:02

Got it working, unfortunately if anyone has similar problem I can't tell you what steps to take because I've taking...so much, but to help you out, just google "xampp on windows 7 very slow" and follow any steps you come across until it works, my last steps where from here :
http://stackoverflow.com/questions/5977 ... -windows-7

exclude
Tried PHP in CGI mode by commenting out (in httpd-xampp.conf): LoadFile "C:/xampp/php/php5ts.dll" and LoadModule php5_module modules/php5apache2_2.dll.
and make HostnameLookups On.
Thanks to all for the support!
pitvenin
 
Posts: 6
Joined: 06. August 2011 10:47


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 61 guests