Virtual Servers on same machine

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Virtual Servers on same machine

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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>
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

OK I Just needed to add
NameViurtualHost webs
To get it working. All's good. Thanks
Post Reply