OAFC_Rob Posted November 30, 2011 Share Posted November 30, 2011 Okay, i've done this at work the other week, its been a very very long day and im at home trying to set some virtual hosts up and for the life of me cant see what the hell is going wrong; It keeps opening up both hosts to the same document root, when they are set differently httpd-vhosts in xampp file <VirtualHost *:80> ServerAdmin postmaster@hannahduff.localhost DocumentRoot "C:/xampp/htdocs/duff3" ServerName hannahduff ServerAlias hannahduff ErrorLog "logs/hannahduff.localhost-error.log" CustomLog "logs/hannahduff.localhost-access.log" combined </VirtualHost> <VirtualHost *:80> ServerAdmin postmaster@dummy-host.localhost DocumentRoot "C:/xampp/htdocs/innovationation" ServerName innovationation ServerAlias innovationation ErrorLog "logs/innovationation.localhost-error.log" CustomLog "logs/innovationation.localhost-access.log" combined </VirtualHost> hosts file within system32/drivers/etc # 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 innovationation 127.0.0.1 hannahduff Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/ Share on other sites More sharing options...
requinix Posted November 30, 2011 Share Posted November 30, 2011 1. Are you sure you're editing the right files? I know the *AMP family can be very confusing. 2. Did you restart XAMPP after making the changes? 3. Which document root does it show? The hannahduff one? Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292760 Share on other sites More sharing options...
OAFC_Rob Posted November 30, 2011 Author Share Posted November 30, 2011 Yes I'm editing the following files; C:/xampp/apache/conf/extra/http-vhosts C:/Windows/System32/drivers/etc Yes I have stop apache, waited a few secons, freshed the browser to get an erorr, started, and refreshed the browser to get the same site Yes it is showing the document root for hannahduff Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292766 Share on other sites More sharing options...
requinix Posted November 30, 2011 Share Posted November 30, 2011 If you switch them around (so innovationation before hannahduff) and restart, do you get the innovationation site instead? If so then Apache isn't recognizing the hostname... Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292772 Share on other sites More sharing options...
OAFC_Rob Posted November 30, 2011 Author Share Posted November 30, 2011 Yeh I swapped them around and did exactly waht you said, so how do i fix it Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292776 Share on other sites More sharing options...
requinix Posted November 30, 2011 Share Posted November 30, 2011 Is there a NameVirtualHost directive in there? You need one. NameVirtualHost 127.0.0.1 Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292789 Share on other sites More sharing options...
OAFC_Rob Posted November 30, 2011 Author Share Posted November 30, 2011 In the hosts file?? Yes, but it is this way around 127.0.0.1 innovationation Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292796 Share on other sites More sharing options...
requinix Posted November 30, 2011 Share Posted November 30, 2011 No, in the httpd-vhosts. Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292808 Share on other sites More sharing options...
OAFC_Rob Posted November 30, 2011 Author Share Posted November 30, 2011 No DOesn't seem to be # # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.2/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # ##NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # ##<VirtualHost *:80> ##ServerAdmin postmaster@dummy-host2.localhost ##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost" ##ServerName dummy-host2.localhost ##ServerAlias www.dummy-host2.localhost ##ErrorLog "logs/dummy-host2.localhost-error.log" ##CustomLog "logs/dummy-host2.localhost-access.log" combined ##</VirtualHost> <VirtualHost *:80> ServerAdmin postmaster@dummy-host.localhost DocumentRoot "C:/xampp/htdocs/duff3/" ServerName hannahduff ServerAlias hannahduff ErrorLog "logs/hannahduff.localhost-error.log" CustomLog "logs/hannahduff.localhost-access.log" combined </VirtualHost> <VirtualHost *:80> ServerAdmin postmaster@dummy-host.localhost DocumentRoot "C:/xampp/htdocs/innovationation/" ServerName innovationation ServerAlias innovationation ErrorLog "logs/innovationation.localhost-error.log" CustomLog "logs/innovationation.localhost-access.log" combined </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292818 Share on other sites More sharing options...
requinix Posted November 30, 2011 Share Posted November 30, 2011 You need one. There is one in there already. Uncomment it. Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292824 Share on other sites More sharing options...
OAFC_Rob Posted December 1, 2011 Author Share Posted December 1, 2011 Yeh, just realised that this morning, after sleeping on it, going to give it a bash when I get home tonight. Thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1293158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.