Jump to content

Recommended Posts

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  :shrug:

 

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

Link to comment
https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292766
Share on other sites

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>







Link to comment
https://forums.phpfreaks.com/topic/252150-xampp-virtual-hosts/#findComment-1292818
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.