Page 1 of 1
Virtual Servers on same machine
Posted: Sat Feb 12, 2005 11:55 am
by Chris Corbyn
Hi,
Using Apache... can the httpd.conf file be changed in any way so that say, a website stroed in C:\Website1\ can be open by running
http://website1/
and a website stored in C:\somedir\website2\ can be opened by running
http://website2/
or does everything on the local machine have to come from localhost?
I know how to create virtual directories with Alias, but I need (well, want actually) a virtual server
Chris
Posted: Sat Feb 12, 2005 11:59 am
by feyd
you need to make changes to your HOSTS file, and httpd.conf to do that. HOSTS file is located at: c:/windows/system32/drivers/etc/
copy the localhost line to whatever names you want..
for the changes to httpd.conf, I believe virtual host/aliasing settings will do it.
however, this will only work on your local machine. Your DNS server would need configuring to map them to a network.
Posted: Sat Feb 12, 2005 12:13 pm
by Chris Corbyn
Thtas fine that's all I want... I dont actually host from my pc anyway I just design and test on it... it's just a nicer way to organise my projects.
Thanks... I'll have a play around
Posted: Sat Feb 12, 2005 12:49 pm
by Chris Corbyn
I can't make it work... I can add new host names that do the same as typing localhost but it's the virtual server settings in httpd.conf i can't figure (I want
http://webs/ to point to C:\Projects\Webs\ as an example)
My HOSTS file
# 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
127.0.0.1 webs
and what I'm adding to httpd.conf
<VirtualHost *:80>
ServerAdmin
nobody@nobdy.com
DocumentRoot C:/Projects/Webs/
ServerName webs
ErrorLog logs/dummy-host.example.com-error_log #Not important
CustomLog logs/dummy-host.example.com-access_log common #Not important
</VirtualHost>
Posted: Sat Feb 12, 2005 1:04 pm
by Chris Corbyn
OK I Just needed to add
NameViurtualHost webs
To get it working. All's good. Thanks