I need to point two domain names to one server. It is an Apache Linux server.

I understand that I can create two A records in the DNS pointing to the same IP. But how do I configure the Apache server, mail server, etc.?

link|improve this question

67% accept rate
feedback

closed as not constructive by Ward, Iain, Khaled, mailq, quanta Nov 1 '11 at 9:49

This question is not a good fit to our Q&A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion. See the FAQ for guidance on how to improve it.

1 Answer

up vote 1 down vote accepted

In your DNS, point both domains to the same IP.

In httpd.conf add a ServerAlias directive for that domain:

<VirtualHost *:80>
ServerName domain1.com
ServerAlias domain2.com
# ...
</VirtualHost>

(You may need to look in another file if httpd.conf has any includes in it.)

Then restart Apache:

service httpd restart

For details on configuring Apache name-based hosts look at:
httpd.apache.org/docs/2.2/vhosts/name-based.html

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.