Virtual Host on Windows with XAMPP

10 Comments
Tags: , , ,
Posted 10 Jan 2007 in How To
Advertisement

On my first tutorial we was try to Installing WordPress on Windows use XAMPP, this time I will give little help again how to tweak our local server, and make it Virtual Host enable. So we can develop many many website in one time and still in our windows local machine.

This tutorial also work on Mac OSX, Linux Desktop, FreeBSD Desktop with little tweak.

What we need?

XAMPP Logo

Let’s get started.

After XAMPP Installed, go to you XAMPP Installed folder. After opened try to edit this file with Notepad++ for more easy way or use Notepad for old way..

Apache > Conf > Extra > httpd-vhosts.conf

After that, try to look this original configuration

#
# 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><virtualhost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</virtualhost>
##<virtualhost *:80>
##    ServerAdmin webmaster@dummy-host2.example.com
##    DocumentRoot /www/docs/dummy-host2.example.com
##    ServerName dummy-host2.example.com
##    ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
##</virtualhost>
#<virtualhost *:80>
#    ServerAdmin webmaster@lab.lokal
#    DocumentRoot "C:/Program Files/xampp/htdocs/lab"
#    ServerName lab.lokal
#    ErrorLog @rel_logfiledir@lab.lokal-error_log
#    CustomLog @rel_logfiledir@lab.lokal-access_log common
#</virtualhost>
#<virtualhost *:80>
#    ServerAdmin webmaster@localhost
#    DocumentRoot "C:/Program Files/xampp/htdocs/smf"
#    ServerName localhost
#    ErrorLog @rel_logfiledir@localhost-error_log
#    CustomLog @rel_logfiledir@localhost-access_log common
#</virtualhost>

Look on that code, is that really long code and if work in Apache, if code have this # the code didn’t executed by Apache server.

Now we will try to add one virtual host, just edit all code above become like this below.

NameVirtualHost *:80
<virtualhost *:80>
    ServerAdmin sampe@mysample.com
    DocumentRoot "C:/Program Files/xampp/htdocs"
    ServerName localhost
</virtualhost>
<virtualhost *:80>
    ServerAdmin webmaster@mywordprees.com
    DocumentRoot "C:/wordpress"
    ServerName www.wordpress.local
    ServerAlias wordpress.local
    <directory "C:/wordpress">
        AllowOverride FileInfo AuthConfig Limit Indexes
        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        <limit GET POST OPTIONS>
            Order allow,deny
            Allow from all
        </limit>
        <limitexcept GET POST OPTIONS>
            Order deny,allow
            Deny from all
        </limitexcept>
    </directory>
</virtualhost>

On code above I try add two virtual host, the first one for take original http://localhost, and the second one for my WordPress virtual host http://wordpress.local

After code was completed, safe and exit.

Now, the magic time, in windows and many Operating Sytem, before they looking another DNS Server, many OS will check they hosts list on they machine, so let add new domain to our hosts machine.

Open you fave editor (Notepad++) for me, and Open File on this folder

C:WINDOWSsystem32driversetc

And select hosts
You will find this code

# Copyright (c) 1993-1999 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

127.0.0.1       localhost

That original Windows hosts, and this the time to add some host on you local machine to enable virtual host, below 127.0.0.1 localhost add this

127.0.0.1       wordpress.local
127.0.0.1       www.wordpress.local

That all, after that restart you Apache and try to point you Browser to new address, and holla you are dona add virtual host on you own local machine.

Popularity: 47%

Share and Enjoy:
  • del.icio.us
  • Facebook
  • Digg
  • Reddit
  • BlinkList
  • NewsVine
  • Print
  • LinkedIn
  • StumbleUpon
  • Sphinn
  • Yahoo! Buzz
  • FriendFeed
  • HelloTxt
  • Google Bookmarks
  • Suggest to Techmeme via Twitter
  • Technorati
  • email
  • PDF

virtual host on windows with xampp indodx

On my first tutorial we was try to Installing WordPress on Windows use XAMPP, this time I will give little help again how to tweak our local server, and make it
Source: http://blog.indodx.com/archives/virtual-host-on-windows-with-xampp.jsp

xampp virtual hosts failing

XAMPP by itself is okay, in fact it runs perfectly except with several projects on my I have written a tutorial on how to set up a virtual host in apache with XAMPP.
Source: http://www.trap17.com/index.php/xampp-virtual-hosts-failing_t42756.html

windows otda xampp yordamida virtual host yaratish quot; uzblogger

Virtual host — oddiy til bilan aytganda bu blog yoki saytni internetga qo Endi mana shu virtual hostni Windows operatsion tizimida XAMPP yordamida o rnatishni o
Source: http://www.uzblogger.com/2008/08/28/windows-otda-xampp-yordamida-virtual-host-yaratish.html

websurf recorder quot; xampp apache virtual host tutorial

This tutorial shows how to setup a virtual host of apache for development in XAMPP. Web Development on Windows using Apache + MySQL + PHP Tutorial )
Source: http://www.websurfrecorder.com/xampp-apache-virtual-host-tutorial.html

xampp installer version for windows textbook

Creating Virtual Host Containers. If you want the ability to test multiple sites on your Now copy the Virtual Host directives from the example block above (starting with
Source: http://textbook.textpattern.net/wiki/index.php?title=XAMPP_(Installer_Version)_for_Windows

set up multiple virtual hosts on xampp for windows mafflog

IT stuff and more As I work on many projects and experiments on my local windows development environment , I normally put all web stuff in the htdocs directory and usually I
Source: http://maff.ailoo.net/2008/07/set-up-multiple-virtual-hosts-on-xampp-for-windows/

setting up virtual hosts with xampp running on windows xp tildemark

Setting up virtual hosts with XAMPP is very straight forward and could be done in less than 5 minutes. Although, your local XAMPP server will still work even if virtual hosts are
Source: http://www.tildemark.com/software/servers/setting-up-virtual-hosts-with-xampp-running-on-windows-xp.html

set up a windows test server using xampp drupal org

XAMPP for Windows makes setting up a local test server on your computer very easy. With XAMPP you set up virtual hosts in the following file: \xampp\apache\conf\extra\httpd-vhost
Source: http://drupal.org/node/161975

xampp virtual hosts failing

Open Discussion about Xampp Virtual Hosts Failing Problem with Apache Server set-up - HIGLIGHTS: Xampp, Virtual, Acces, Host, Server, Localhost, Window, Linux
Source: http://www.trap17.com/index.php/xampp-virtual-hosts-failing_t42756.html

sawyer mcfarland media inc

Launch Notepad and open the hosts file located at C:\windows\system32\drivers The first five lines of code turn on the Virtual Host feature on Apache, and set up the C:\xampp
Source: http://www.sawmac.com/xampp/virtualhosts/


8 Comments

  1. Like your tutorial.
    Got Virtual Host running.

    Thanks

  2. Great post, was very helpful in setting up my multiple hosting arrangement.
    Took some sorting out to make sure it would work, so I thought I’d share what I did here.

    I was using xampp, so added the details in the http-vhosts.conf file, saved, then tried to restart – and apache just wouldn’t restart. Deleted everything I had changed and it worked fine. But I didn’t have the multiple hostings.

    I took a look through the info on the Apache website, and read through the httpd.conf file, and then realised a couple of things.

    The first entry in your http-vhosts.conf file must have exactly the same detail as what’s in your httpd.conf file.

    Also, I don’t think I realised that the DocumentRoot had to be in “Inverted Commas” – they are in your post, I just don’t think I recognised that at the time.

    But I’ve now got it set up and will be hosting my websites from there soon!

  3. Franz

    This works great! You just made me so much more productive.

  4. Jesse

    I have a server running on linux, but I want to run an XAMPP server too.

    How can I set it up so that I can access the XAMPP server remotely?

    Is there a way to change the adress to access the server?

    (anyway, thanks for the tut. :D)

  5. WTF? Do you use XAMPP? Does it require conf editing? Oh guys, visit russian site denwer.ru . If it’s difficult to you to understand it, go directly
    http://www.denwer.ru/dis/Base/Denwer3_Base_2008-01-13_a2.2.4_p5.2.4_m5.0.45_pma2.6.1.exe
    it will create sites and subdomain as fast as you add diretory to Z:\home\yoursitename\www\ + all alias.
    It’s really easy to test locally ;)

  6. bryant

    I didnt use:
    Apache > Conf > Extra > httpd-vhosts.conf
    just to make it work. Although I want to place it there. The problem is I cant make it work. I havent tried:

    “The first entry in your http-vhosts.conf file must have exactly the same detail as what’s in your httpd.conf file.” as suggested by Ben. So my hosting entry is on httpd.conf. And of course, I set the hosts file on Windows.

  7. Thanks, works great for me on Vista 32-bit. I’ve been trying to figure out vhosts forever!

  8. epox

    if you copy this text directly and edit your settings, you should get in trouble because the ” are not correctly parsed, i retyped the ” and it works


2 Trackbacks/Pingbacks

  1. Jauhari Didetik | Seting Virtual Host di XAMPP Windows 22 06 08
  2. links for 2008-06-24 | Conteúdo Interativo 24 06 08

Add Your Comment

We Are DoFollow, it' mean No Follow Free ;)