Solved

multiple Domains on one IP address

Posted on 2000-04-07
11
196 Views
Last Modified: 2010-03-18
Can some one explain to me how i can setup multiple domain names on one ip address ??  I'm running RedHat 6.1 and I'm running the latest Apache.
0
Comment
Question by:ttrogden
  • 6
  • 5
11 Comments
 
LVL 2

Accepted Solution

by:
munsie earned 100 total points
ID: 2695147
well, first you need to have your DNS setup to point to that address for each of domains.

Then, for each virtual domain, you need to add a section to your configuration file

for example, to have www.abc.com and www.xyz.com, you can do the following:

NameVirtualHost xx.xx.xx.xx   <-- machine's ip address

<VirtualHost xx.xx.xx.xx>
ServerName www.abc.com
ServerPath /abc
DocumentRoot /home/httpd/www.abc.com
</VirtualHost>

<VirtualHost xx.xx.xx.xx>
ServerName www.xyz.com
ServerPath /xyz
DocumentRoot /home/httpd/www.xyz.com
</VirtualHost>

You can stick any additional options for each site into the VirtualHost section and you can place default options for all of the sites into the main server section.
 
The ServerPath directive allows for compatibilty with older HTTP/1.0 browsers, so that they can still access all of the different servers.  What you will need to do is on the primary hostname's web page, place links to http://www.primary.name.com/virtual_name/ for each of the sites.  If you don't do this, you might close out users of older browsers.

For more info, goto www.apache.org, but this should get you going.

good luck,
dennis
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2695167
Now - I want to have these domain names share the same server/Ip address.  Also the server is also the DNS server.  Will this work ??


0
 
LVL 2

Expert Comment

by:munsie
ID: 2695174
yes, to sum it up

in your DNS, you'll add a alias/CNAME to your DNS for each virtual host you want.

when you do a lookup on the virtual name, it will resolve to your one IP address.  If you do a reverse name lookup, it will come back with the main server name.

apache keys off the host name sent with the http request and serves the proper page.

dennis
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 1

Author Comment

by:ttrogden
ID: 2695200
ok - For our documentroot - can it be /home/abc/public_html and /home/xzy/public_html

or does it have to be in /home/httpd/abc and /home/httpd/xyz

I'm sorry to be so naive about this.


Tommyt
0
 
LVL 2

Expert Comment

by:munsie
ID: 2695233
it can be anywhere you want it on the system...

i was just using /home/httpd because RedHat defaults to using that as it's http directory.

actually, i can see where /home/abc/public_html would be more useful, because you can give the owner of that site a login and let them change things on their own.

but to answer the question, it will work... just make sure that user nobody can read files in that directory (just 'su - nobody', and verify that you can see all of the files)

dennis
0
 
LVL 2

Expert Comment

by:munsie
ID: 2695234
it can be anywhere you want it on the system...

i was just using /home/httpd because RedHat defaults to using that as it's http directory.

actually, i can see where /home/abc/public_html would be more useful, because you can give the owner of that site a login and let them change things on their own.

but to answer the question, it will work... just make sure that user nobody can read files in that directory (just 'su - nobody', and verify that you can see all of the files)

dennis
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2695302
ok I hope this is the last question for you.  BTW - your getting an A on this one - thanks a bunch fro your help.  On that note - what file do i have to add that stuff to ??


tommyt
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2695388
ok - i created the virtual servers in the httpd.conf the way you described it above - now you said for me to make some changes in the dns - can you give more details of how i should do this
0
 
LVL 2

Expert Comment

by:munsie
ID: 2695398
I know you need to add the CNAME record for the host, but I don't know exactly what that entails... i would recommend looking at the DNS-HOWTO... if you installed everything under RedHat, this will be located in /usr/doc/HOWTO/DNS-HOWTO

good luck,
dennis

0
 
LVL 1

Author Comment

by:ttrogden
ID: 2695413
thanks for the help
0
 
LVL 2

Expert Comment

by:munsie
ID: 2696049
no problem

dennis
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reaching outside NTP servers from within a domain? 12 103
how to view remote client's ipv6 address? 5 71
Monitor Aliased network interface bandwitch CentOS 4 91
centos linux 65 123
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question