domain hosting configuration

This is a discussion on domain hosting configuration within the Apache Web Server forums, part of the Web Server and Related Forums category; I am an apache newbie. I have various domain addresses forwarding to my web server, I would like to have ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-02-2006
Milo Hoffman
 
Posts: n/a
Default domain hosting configuration

I am an apache newbie.

I have various domain addresses forwarding to my web server, I would
like to have apache direct the requests to the appropriate site.

For example,

site.com -> goes to the site.com web folder
site2.com -> goes to the site2.com folder
site3.com -> goes to the site3.com folder

Is this possible? How do I set it up so that I can have a single apache
webserver responding / serving multiple sites?

Matt

  #2 (permalink)  
Old 07-02-2006
BlueC
 
Posts: n/a
Default Re: domain hosting configuration

Milo Hoffman wrote:
> I am an apache newbie.
>
> I have various domain addresses forwarding to my web server, I would
> like to have apache direct the requests to the appropriate site.
>
> For example,
>
> site.com -> goes to the site.com web folder
> site2.com -> goes to the site2.com folder
> site3.com -> goes to the site3.com folder
>
> Is this possible? How do I set it up so that I can have a single apache
> webserver responding / serving multiple sites?
>
> Matt
>


VirtualHosts - try reading the apache documentation like the rest of us
had to.

http://httpd.apache.org/docs/

Very basically (man I am nice):

<VirtualHost *:80>
DocumentRoot "/path/to/site.com/folder/"
ServerName www.site.com
</VirtualHost>


--
BC
  #3 (permalink)  
Old 07-02-2006
BlueC
 
Posts: n/a
Default Re: domain hosting configuration

BlueC wrote:
> Milo Hoffman wrote:
>> I am an apache newbie.
>>
>> I have various domain addresses forwarding to my web server, I would
>> like to have apache direct the requests to the appropriate site.
>>


Didn't see that "forwarding" bit - what do you mean by "forwarding"?

Do you mean the DNS record is pointing the domain to your server IP
address? If so that will work with VirtualHosts. If you mean something
else, then it probably won't.

--
BC
  #4 (permalink)  
Old 07-03-2006
Milo Hoffman
 
Posts: n/a
Default Re: domain hosting configuration

What I mean is I have multiple .com addresses. 3 to be specific. They
are all pointing to my server IP. I want apache to serve the correct
site to each request when it hits my site. Right now any one of them
will see the same default site.

So will VirtualHosts accomplish this?

BlueC wrote:
> BlueC wrote:
> > Milo Hoffman wrote:
> >> I am an apache newbie.
> >>
> >> I have various domain addresses forwarding to my web server, I would
> >> like to have apache direct the requests to the appropriate site.
> >>

>
> Didn't see that "forwarding" bit - what do you mean by "forwarding"?
>
> Do you mean the DNS record is pointing the domain to your server IP
> address? If so that will work with VirtualHosts. If you mean something
> else, then it probably won't.
>
> --
> BC


  #5 (permalink)  
Old 07-03-2006
BlueC
 
Posts: n/a
Default Re: domain hosting configuration

Milo Hoffman wrote:
> What I mean is I have multiple .com addresses. 3 to be specific. They
> are all pointing to my server IP. I want apache to serve the correct
> site to each request when it hits my site. Right now any one of them
> will see the same default site.
>
> So will VirtualHosts accomplish this?
>


Yes. VirtualHosts will accomplish that. You just need a different
VirtualHost for each domain.

I just got confused by the term "forwarding" because that is sometimes
used to describe something else.

Below is how to do it, but seriously, read the apache docs, they will
help you a GREAT deal.

<VirtualHost *:80>
DocumentRoot "/path/to/site1.com/folder/"
ServerName www.site1.com
ServerAlias site1.com
# Other stuff
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/path/to/site2.com/folder/"
ServerName www.site2.com
</VirtualHost>

.... etc ...

--
BC
  #6 (permalink)  
Old 07-03-2006
Milo Hoffman
 
Posts: n/a
Default Re: domain hosting configuration

Thanks! I will definately read through the docs on this and other
topics.

BlueC wrote:
> Milo Hoffman wrote:
> > What I mean is I have multiple .com addresses. 3 to be specific. They
> > are all pointing to my server IP. I want apache to serve the correct
> > site to each request when it hits my site. Right now any one of them
> > will see the same default site.
> >
> > So will VirtualHosts accomplish this?
> >

>
> Yes. VirtualHosts will accomplish that. You just need a different
> VirtualHost for each domain.
>
> I just got confused by the term "forwarding" because that is sometimes
> used to describe something else.
>
> Below is how to do it, but seriously, read the apache docs, they will
> help you a GREAT deal.
>
> <VirtualHost *:80>
> DocumentRoot "/path/to/site1.com/folder/"
> ServerName www.site1.com
> ServerAlias site1.com
> # Other stuff
> </VirtualHost>
>
> <VirtualHost *:80>
> DocumentRoot "/path/to/site2.com/folder/"
> ServerName www.site2.com
> </VirtualHost>
>
> ... etc ...
>
> --
> BC


  #7 (permalink)  
Old 07-03-2006
Milo Hoffman
 
Posts: n/a
Default Re: domain hosting configuration

So I have successfully hosted two sites on the same box. I am quite
pleased. However, I have a strange problem.

I have aliased the sites so either can be reached from www.site.com or
site.com, however, the second site (site2.com in this example) cannot
be reached without the www in front of it. I get a timeout error! It
doesn't make sense to me as I have literally copy and pasted the vhost
config from the first one I did (site1 in this example).

Any idea what I have done wrong?

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/www/site1"
ServerName site1.com
ServerAlias www.site1.com
ErrorLog "C:/www/site1-error_log.txt"
CustomLog "C:/www/site1-access_log.txt" common
</VirtualHost>

#
# This is to permit URL access to scripts/files in www/site1 directory
#
<Directory "C:/www/site1">
allow from all
</Directory>

<VirtualHost *:80>
DocumentRoot "C:/www/site2"
ServerName site2.com
ServerAlias www.site2.com
ErrorLog "C:/www/site2-error_log.txt"
CustomLog "C:/www/site2-access_log.txt" common
</VirtualHost>

#
# This is to permit URL access to scripts/files in www/site2 directory
#
<Directory "C:/www/site2">
allow from all
</Directory>

BlueC wrote:
> Milo Hoffman wrote:
> > What I mean is I have multiple .com addresses. 3 to be specific. They
> > are all pointing to my server IP. I want apache to serve the correct
> > site to each request when it hits my site. Right now any one of them
> > will see the same default site.
> >
> > So will VirtualHosts accomplish this?
> >

>
> Yes. VirtualHosts will accomplish that. You just need a different
> VirtualHost for each domain.
>
> I just got confused by the term "forwarding" because that is sometimes
> used to describe something else.
>
> Below is how to do it, but seriously, read the apache docs, they will
> help you a GREAT deal.
>
> <VirtualHost *:80>
> DocumentRoot "/path/to/site1.com/folder/"
> ServerName www.site1.com
> ServerAlias site1.com
> # Other stuff
> </VirtualHost>
>
> <VirtualHost *:80>
> DocumentRoot "/path/to/site2.com/folder/"
> ServerName www.site2.com
> </VirtualHost>
>
> ... etc ...
>
> --
> BC


  #8 (permalink)  
Old 07-03-2006
BlueC
 
Posts: n/a
Default Re: domain hosting configuration

Milo Hoffman wrote:
> So I have successfully hosted two sites on the same box. I am quite
> pleased. However, I have a strange problem.
>
> I have aliased the sites so either can be reached from www.site.com or
> site.com, however, the second site (site2.com in this example) cannot
> be reached without the www in front of it. I get a timeout error! It
> doesn't make sense to me as I have literally copy and pasted the vhost
> config from the first one I did (site1 in this example).
>
> Any idea what I have done wrong?
>


Odd indeed. Restarted apache? Checked that your DNS entries are correct
for the site2.com and www.site2.com?

--
BC
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:23 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0