Solved

multiple Domains on one IP address

Posted on 2000-04-07
11
197 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 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