Solved

multiple Domains on one IP address

Posted on 2000-04-07
11
193 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:ttrogden
Comment Utility
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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 2

Expert Comment

by:munsie
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks for the help
0
 
LVL 2

Expert Comment

by:munsie
Comment Utility
no problem

dennis
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SNMP configuration on Debian server 5 80
linux / python expert needed 3 79
linux 2 76
BIND DNS - Single Zone 2 views 5 59
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 video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now