Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 6th, 2001, 04:09 PM
benbun benbun is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 44 benbun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 37 sec
Reputation Power: 8
APACHE / Win98 / Virtual Hosts.

As will soon become clear I know nothing about setting up APACHE, so I am looking for help from any resident expert.

I have installed APACHE on my Win98 machine to use for local testing of web sites prior to deploying them with my hosting company.

I have numerous sites on the go at any one time and want to be able to set up APACHE so that I can access them all by either entering a different domain name

i.e.

http://mysite1/
http://mysite2/
http://mysite3/

or by using ports

Http://localhost:9000/
Http://localhost:9001/
Http://localhost:9002/

can some one tell me (in lots of detail!!) how to set up my "httpd.conf" file to acheive this. I have no local DNS so the solution must not rely on one.

Thanks in advance....

Richard

Last edited by benbun : September 6th, 2001 at 04:12 PM.

Reply With Quote
  #2  
Old September 7th, 2001, 12:51 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> I have no local DNS so the solution must not rely on one

Then use C:\Windows\Hosts file. Just put:

127.0.0.1 localhost mysite1 mysite2 mysite3

This file doesn't exist by default, so create it manually.

Reply With Quote
  #3  
Old September 7th, 2001, 03:02 AM
benbun benbun is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 44 benbun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 37 sec
Reputation Power: 8
Great - I'll give that a try !!.

How do I set up APACHE so that each doimain uses a different root directory.

RK

Reply With Quote
  #4  
Old September 7th, 2001, 03:24 AM
olila olila is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: Copenhagen, Denmark
Posts: 48 olila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
NameVirtualHost 192.168.1.2


<VirtualHost 192.168.1.2>
DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/host1"
ServerName host1
serveralias www.host1.com

</VirtualHost>
<Directory "D:/Program Files/Apache Group/Apache/htdocs/host1">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

</Directory>

<VirtualHost 192.168.1.2>
DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/host2"
ServerName host2
ServerAlias www.host2.com

</VirtualHost>
<Directory "D:/Program Files/Apache Group/Apache/htdocs/host2">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Setup your host file as described by wizard freebsd
__________________
\Oliver

For those about to php - we salute you!

Reply With Quote
  #5  
Old September 7th, 2001, 03:59 PM
benbun benbun is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 44 benbun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 37 sec
Reputation Power: 8
Ok, I have set up my HOSTS file and it works perfectly.

I now have several "domains" than point ot the same site.

The next step was to set up the virtual hosts so they point to different places.

My httpd.conf file is shown below (relevant bit)

NameVirtualHost 127.0.0.1
#
# 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.
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "D:\BenBun Web Services\benbun05"
ServerName benbun
serveralias www.benbun.com
</VirtualHost>
<Directory "D:\BenBun Web Services\benbun05">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<VirtualHost 127.0.0.1>
DocumentRoot "D:\BenBun Web Services\Site - NCL"
ServerName bbws1
ServerAlias www.bbws1.com
</VirtualHost>
<Directory "D:\BenBun Web Services\Site - NCL">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

This works fine.

Entering

http://benbun shows site #1
http://bbws1 shows site #2

The problem is that for bbws1 to work I need to be connected to the internet, even though it is served from my local PC. Why does it insist on connecting to the web ?.

Any ideas appreciated.

Richard

Reply With Quote
  #6  
Old September 8th, 2001, 03:21 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You C:\Windows\Hosts then needs to be:

127.0.0.1 localhost benbun bbws1 www.benbun.com www.bbws1.com

If bbws1 is not found in Hosts file, it will query your nameserver for the answer.
Even if you put a real domain like www.yahoo.com to your Hosts file, it should work.

Reply With Quote
  #7  
Old September 8th, 2001, 06:21 PM
menator's Avatar
menator menator is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2001
Posts: 549 menator User rank is Sergeant (500 - 2000 Reputation Level)menator User rank is Sergeant (500 - 2000 Reputation Level)menator User rank is Sergeant (500 - 2000 Reputation Level)menator User rank is Sergeant (500 - 2000 Reputation Level)menator User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 8 sec
Reputation Power: 14
Send a message via MSN to menator
I too would like to learn about setting up apache for virtualhost
I understand most of what was explained except the part
about c:\windows\host file.
I have the virtualhost setup but when I type the http://host1 I
get the cannot find server.

My question? What kind of file is the host file and where does it
need to be placed.

Thanks in advance. Johnny

Reply With Quote
  #8  
Old September 9th, 2001, 05:59 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> What kind of file is the host file

That's for resolving non-routable IP to hostname (LAN or local). With that properly setup, you should be able to ping those hostname and it should return the mapped IP accordingly.
Apache listens to all NIC by default, including internal, external or even loopback. That said, for external, it relies on querying nameserver (DNS). For internal, you just need to setup hosts file (on each box you want the hostname to be resolvable).
In order to setup vhosts in Apache, the vhost's hostname MUST be resolvable, whether it's external or internal.

>> where does it need to be placed

In Win9x -> C:\Windows\Hosts
In WinNT/2K/XP -> C:\WinNT\System32\drivers\etc\Hosts
In Linux/BSD/UNIX -> /etc/hosts (case-sensitive)

Last edited by freebsd : September 9th, 2001 at 06:02 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > APACHE / Win98 / Virtual Hosts.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway