Virtual hosting is simple to set up in XP - but picky..
* I have a software folder where I keep all my downloaded SW - it got pretty big and I wanted to move it to another partition. To have it seen correctly in apache, I created a virtual host for it - this tutorial is a write-up of the solution that works on my home XP SP2 box with Apache 2.0.59.
1. Edit the hosts file ( windows XP: C:\Windows\system32\drivers\etc\hosts ) - every virtual host has the IP 127.0.0.1
2. Add vhost entries to httpd.conf + set the correct NamedVirtualhost directive (see below)
3. Create a virtual host for the primary server - the first vhost entry is used as the server default.
4. reboot -or-
* stop Apache
* Disable your network connection
* Clear Mozilla/IE/Opera cache and close
* Enable network connection
* start Apache
`hosts` file entries:
# # IP of the box on the home network - 192.168.0.20, and I use DynDNS for dyamic hosting # separate entries are easier to read... 192.168.0.20 hostname1.tld 127.0.0.1 localhost 127.0.0.1 hostname1.tld 127.0.0.1 software.hostname1.tld 127.0.0.1 hostname2.tld #
`httpd.conf` (or other file that is included by httpd.conf, such as vhosts.conf) virtual hosts entries:
#
# 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 requests without a known
# server name.
#
# The original server
<VirtualHost *:80>
DocumentRoot C:/WWW/htdocs
ServerName hostname1.tld
</VirtualHost>
#
# Ran out of space ran C drive, relocated /software to D drive.
<VirtualHost *:80>
DocumentRoot D:/WWW/htdocs/software
ServerName software.hostname1.tld
</VirtualHost>
#
<VirtualHost *:80>
DocumentRoot D://WWW/hostname2.tld/htdocs
ServerName hostname2.tld
ServerAlias *.hostname2.tld
</VirtualHost>






0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment