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:
  #1  
Old March 3rd, 2001, 08:27 AM
mstembri mstembri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458 mstembri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
This sounds like a dumb question, but I need to ask it anyway.

How do I host two web sites from the same box? I know that servers all over the country do this, but I don't know how to work out the IP stuff.

I have a static IP of 123.123.123.123 that all port 80 requests go to. From there what do I do? How does the server know which page to serve?

tia.
__________________
- Mike Stembridge
http://www.georgiaoffroad.com

Reply With Quote
  #2  
Old March 3rd, 2001, 01:38 PM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
You need to use the <VirtualHost> directive of apache, it's at the end of your httpd.conf file, just add both domains to it with whatever other arguments you want to include. You'll also need to set up the dns info if you're the dns server.
terry

[Edited by tlthomas on 03-03-2001 at 12:41 PM]

Reply With Quote
  #3  
Old March 3rd, 2001, 03:13 PM
mstembri mstembri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458 mstembri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Even with the VirtualHost directive, how does the computer know that a request coming to my sole IP is meant for one site or another?

Reply With Quote
  #4  
Old March 3rd, 2001, 04:15 PM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
That's what the VirtualHost directive does, if a request comes in for site "A" it delivers info from that sites directory (DocumentRoot), if a request comes in for site "B" it delivers from its directory and so on...


Reply With Quote
  #5  
Old March 3rd, 2001, 04:41 PM
mstembri mstembri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458 mstembri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Forgive me for being a little thick-skulled about this, but I'm still not clear on the process.

If my machine will only responds to requests sent to say 24.45.56.67 - how will it know that the user making a call to that IP wants to see Site A vs Site B?

This gets back to domain registration, I beleive. With register.com I have to provide DNS servers for each site registered. This leads to two additional questions.

1) What would I list as my DNS server for a site on my local machine?

2) How does that information (the DNS server entered on register.com) help my computer know which pages to serve?

Thanks for your patience

Reply With Quote
  #6  
Old March 3rd, 2001, 04:54 PM
mstembri mstembri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458 mstembri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
http://httpd.apache.org/docs/vhosts/examples.html

Apache provides several examples on the page. I thought I'd be using Setup2 in the first section, but I see that is for situations involving domain.com and sub.domain.com.

That is good to know, however I'll be working with domain.com and otherdomain.com.

The only examples they provided were for dual IP machines.


Reply With Quote
  #7  
Old March 3rd, 2001, 06:00 PM
Hokey Hokey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 5 Hokey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The <VirtualHost> directive can be set to be IP based or to be URI based.

To set up virtual hosts based on FQDN (Fully qualified domain names) .. set up the httpd.conf to contain info about each VHost like this:

NameVirtualHost 123.123.123.123
<VirtualHost 123.123.123.123>
ServerName http://www.firstdomain.com
ServerAdmin yourname@firstdomain.com
DocumentRoot /path/firstdomain
ErrorLog /path-to-logs/errorlog.first
{all other directives}
</VirtualHost>
<VirtualHost 123.123.123.123>
ServerName http://www.seconddomain.com
ServerAdmin yourname@seconddomain.com
DocumentRoot /path/seconddomain
ErrorLog /path-to-logs/errorlog.second
{all other directives}
</VirtualHost>

or something simmular to this. you can put any directive in each VHost (directory, security, etc)

When the httpd server starts ... it will listen to 123.123.123.123. When a request comes in it will look at the URL and direct it to the appropriate pages.


You will also need to set the DNS entries for each FQDN in each of the DNS zones.

in the zone for firstdomain.com
www 123.123.123.123

in the zone for seconddomain.com
www 123.123.123.123

Reply With Quote
  #8  
Old March 3rd, 2001, 06:51 PM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
Question... is your isp pointing your domain toward your ip or are you running a dns server on your machine? If your isp is pointing they need to change their dns server to point the new (#2) domain toward your ip too, also in ref. to Hokey, are you running a windows server or a linux/unix server because there are various things that are different about dns servers depending on the os
terry

Reply With Quote
  #9  
Old March 4th, 2001, 04:29 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
>> how will it know that the user making a call to that IP wants to see Site A vs Site B?

You don't tell people to go to your site at: http://123.123.123.123/. Instead, you tell them the domain name http://www.firstdomain.com and http://www.seconddomain.com.
But still, when people are trying to reach your site via http://123.123.123.123/, they can still get to your http://www.firstdomain.com/

>> 1) What would I list as my DNS server for a site on my local machine?

How many static IP do you have?

>> 2) How does that information (the DNS server entered on register.com) help my computer know which pages to serve?

Your nameserver can take care of that. It depends on how many static IP you have. Say your box is named "www.firstdomain.com", you can add an A record of that to your nameserver that points to 123.123.123. For http://www.seconddomain.com, you can also add an A record pointing to the same IP (123.123.123.123).
Forget about PTR record (for reverse lookup), most ISP won't let you delegate the 123.123.123.123.in-addr.arpa. yourself.

You probably get confused by now, so here is a short answer:
Get both http://www.firstdomain.com and http://www.seconddomain.com to resolve to 123.123.123.123, then you may begin to configure Apache. If you can't do this, just give it up or change ISP.

Reply With Quote
  #10  
Old March 11th, 2001, 01:08 PM
Irestone Irestone is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 Irestone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have been having a sililar problem for some time, and I'm completely unable to pass this one hurdle. I use Apache on a Windows 2000 box.

I have three domains which are all registered through register.com. I use their DNS servers. They all point to my external IP address of 123.123.123.123. I have a Linksys DSL router which is mapped to that external IP, and forwards port 80 requests to one of the computers behind the Linksys. The Linksys acts as a DHCP server, so the actual machine with Apache loaded has an IP of 192.168.1.101, and gets the port 80 requests.

Here is my current setup...

NameVirtualHost 123.123.123.123
<VirtualHost 123.123.123.123>
ServerName URL
ServerAdmin yourname@firstdomain.com
DocumentRoot /firstdomain
</VirtualHost>

<VirtualHost 123.123.123.123>
ServerName URL
ServerAdmin yourname@seconddomain.com
DocumentRoot /seconddomain
</VirtualHost>

<VirtualHost 123.123.123.123>
ServerName URL
ServerAdmin yourname@seconddomain.com
DocumentRoot /thirddomain
</VirtualHost>

My default directory to serve files from is the htdocs directory, and I have subdirectories of firstdomain, seconddomain and thirddomain in the htdocs directory. I cannot get URL to pick up the docs in the firstdomain subdirectory. It ALWAYS defaults to the root htdocs directory. I have tried several things, but I can't get it past this point. I really feel like I'm close to successfully hosting these three domains, and am at the end of my ideas. Anyone have any suggestions as to what I'm doing wrong? Thanks for any help you can provide.

Reply With Quote
  #11  
Old March 11th, 2001, 01:23 PM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
Hi, you need to put the full path to each DocumentRoot, replace
DocumentRoot /first(second, etc)domain
with
DocumentRoot c:/apache/home/htdocs/anydomain
or whatever the full path is on your machine....
terry
__________________
It works better if you plug it in!

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Serving two pages (domains) from one machine


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 6 hosted by Hostway
Stay green...Green IT