LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-22-2003, 04:50 PM   #1
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Rep: Reputation: 15
Cool How to host two websites on one computer


Hey I have red hat 9, and I want to host two sites on one machine. I want both sites to be independent. One is stlukesserviceleague.org and the other is arizonahealthquotes.com. I do not want to set up the machine so that one is virtual (i.e. something like stlukesserviceleague.arizonahealthquotes.com or something like that.) I want to set it up to where one is totally independent of the other, but on the same computer. How would i go about doing this with apache? Thanx guys, you rock!
 
Old 07-22-2003, 05:25 PM   #2
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
Yes, you will need to use Virtual Host.

The term Virtual Host in Apache refers to the practice of running more than one web site (such as www.company1.com and www.company2.com) on a single machine.

Take a look at the Apache documentation for more information.
Also, there are some GUI tools such as WebMin which can help you configure Apache.

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

Apache 2.0
http://httpd.apache.org/docs-2.0/
 
Old 07-22-2003, 09:18 PM   #3
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
Thank you and where would i get webmin from?
 
Old 07-23-2003, 09:43 AM   #4
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
Post RPM or .tar.gz

Webmin
http://www.webmin.com/
 
Old 07-23-2003, 10:27 AM   #5
bieb
LQ Newbie
 
Registered: Jul 2003
Location: Atlanta, GA
Distribution: Red Hat
Posts: 1

Rep: Reputation: 0
You can also edit your httpd.conf file directly. The httpd.conf file lives in (RH) /etc/httpd/conf then use your favorite editor (vi, pico, joe...etc) and find the section named VirtualHost here is what your entries should look like:

<VirtualHost yourIP address:80>
DocumentRoot "/where/your/site/lives"
ServerName www.mysite1.com
</VirtualHost>

<VirtualHost yourIP address:80>
DocumentRoot "/where/your/site/lives"
ServerName mysite1.com
</VirtualHost>

<VirtualHost yourIP address:80>
DocumentRoot "/where/your/site/lives"
ServerName www.mysite2.com
</VirtualHost>

<VirtualHost yourIP address:80>
DocumentRoot "/where/your/site/lives"
ServerName mysite2.com
</VirtualHost>

Hope this helps.
Bieb
 
Old 07-23-2003, 12:32 PM   #6
Rumblefish
Member
 
Registered: Jun 2003
Location: Delaware
Distribution: Redhat 7.0, 7.2, 8.0, 9.0, FreeBSD 4.6.2
Posts: 51

Rep: Reputation: 15
Actually it's not necessary to have separate virtual hosts for mysite.com and www.mysite.com. This can more easily be handled within the DNS server.

Also, at some point in your httpd.conf file *before* you define the virtual hosts, you will need

NameVirtualHost xxx.xxx.xxx.xxx

(Replace xxx.xxx.xxx.xxx with the IP address)

So you'd have

NameVirtualHost 10.0.0.1

<VirtualHost 10.0.0.1:80>
DocumentRoot /path/to/docs
Servername www.mysite.com
</VirtualHost>

<VirtualHost 10.0.0.1:80>
DocumentRoot /path/to/docs
Servername www.myothersite.com
</VirtualHost>

There are a mess of other directives you can, and often should, use to further customize the virtual host. View the documentation for your version of Apache at http://httpd.apache.org/
 
Old 07-23-2003, 12:48 PM   #7
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
The directive you need to use in this case is ServerAlias.
Code:
<VirtualHost 10.0.0.1:80>
  DocumentRoot /path/to/docs
  Servername mysite.com
  ServerAlias www.mysite.com
</VirtualHost>
 
Old 07-23-2003, 01:08 PM   #8
Rumblefish
Member
 
Registered: Jun 2003
Location: Delaware
Distribution: Redhat 7.0, 7.2, 8.0, 9.0, FreeBSD 4.6.2
Posts: 51

Rep: Reputation: 15
That will work fine if you only want to let people access the actual web site through www.mysite.com. However, if you want to allow other services to be accessed via www.mysite.com, you will need to use a CNAME record in the DNS server instead. For the purposes discussed here, though, ServerAlias will work as desired.
 
Old 07-23-2003, 02:19 PM   #9
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
LOL well i'm totally confused now, but I guess i will just try everything you just suggested.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Apache - running multiple websites on one host xtra Linux - General 5 06-30-2010 04:51 AM
telnet <host> 135 to a windows computer sporadic235 Linux - Security 1 06-18-2004 11:28 AM
Host (computer) name change? Underworld Linux - Software 8 07-22-2003 04:00 AM
I want to host Websites king_trance Linux - Networking 2 07-04-2002 01:06 AM
Apache SSL - how to virtual host two or more secure websites on the same machine? bjoshi Linux - Networking 0 08-30-2001 07:01 PM


All times are GMT -5. The time now is 08:45 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration