LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-04-2009, 05:52 PM   #1
jef3189
LQ Newbie
 
Registered: Sep 2008
Posts: 19

Rep: Reputation: 0
One server, multiple domains/websites.


I am running one server, and it's currently setup to host my friends website, www.somesite.com. Now lets say I wanted to host a second site www.someothersite.com on the same server as a virtual host. How would I point the second domain to my server, and how would it work so the server would know which site to display?

ex. if I go to somesite.com how would the server know to display somesite.com and not someothersite.com?
 
Old 04-04-2009, 06:09 PM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
Assuming you are using Apache, you can set up more than one domain on a single server using name based virtual hosts - see the Apache documentation here.

As for pointing the second domain to your server, for it to be available over the internet, you would have to register the domain - Google for "domain registration", or see the adverts in most IT mags.

Last edited by Robhogg; 04-04-2009 at 06:12 PM. Reason: More up-to-date link
 
Old 04-04-2009, 07:10 PM   #3
jef3189
LQ Newbie
 
Registered: Sep 2008
Posts: 19

Original Poster
Rep: Reputation: 0
I know of virtual hosts. I have two registered domain names. I guess my question is specifically how the server knows which site to display?

If both domain names resolve to the same IP address (same server), then where does it differentiate between site one and site two?
 
Old 04-04-2009, 07:53 PM   #4
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by jef3189 View Post
I know of virtual hosts. I have two registered domain names. I guess my question is specifically how the server knows which site to display?

If both domain names resolve to the same IP address (same server), then where does it differentiate between site one and site two?
If you're asking that question then you don't know of virtual hosts


Take this for example (taken from the link that Robhogg gave...note the bold):

Code:
NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>
The "ServerName" is the key...if a request comes in (doesn't matter if it "shares" the ip) for www.domain.tld Apache will "route" it to the doc root /www/domain and serve the HTML pages there (the same goes for www.otherdomain.tld).

-C

Last edited by custangro; 04-05-2009 at 11:17 AM.
 
Old 04-04-2009, 11:21 PM   #5
jef3189
LQ Newbie
 
Registered: Sep 2008
Posts: 19

Original Poster
Rep: Reputation: 0
ok I get it now. Yeah that makes perfect sense. Thanks for clarifying guys! Now I can host both my friends and my own personal site off the same box.
 
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple domains in LDAP and 1 samba server for all domains, what to do? xnomad Linux - Server 1 11-14-2008 09:12 AM
Multiple Websites - 1 server metallica1973 Linux - Server 8 06-16-2008 11:18 AM
serving multiple domain websites on one server? gsgleason Linux - Software 1 06-03-2005 10:50 AM
Securing Multiple Domains on 1 Server jgillin Linux - Security 1 05-10-2004 06:44 AM
multiple pop domains one 1 server dafi Linux - Networking 0 08-11-2001 05:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration