Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to host two websites with different domain names, on a single server, with a single IP address.

I have a fixed IP address with my service provider. It points to my router which port forwards everything on port 80 to a mac mini server on my local network.

How would I get that mac mini server to host two different websites on the same IP address?

Do I need to play around with the DNS on the Mac, or on the router (which is the entry point for the fixed IP address)? IE on the local network, does each domain name needs its own IP address so that these can be resolved by the single server? Little confused as to where to start. Thanks for help.

share|improve this question
up vote 8 down vote accepted

Set up a virtual host. See the following docs

Once you've set this up you can test it locally by adding an entry to your hosts file.



host1   <your ip address>
host2   <your ip address>

then browse to http://host1 and http://host2

share|improve this answer
Matt, Most MacOS X Server users should use the GUI application, Server Admin, to add virtual hosts to Apache. They should really use Server Admin at all times unless they really have to make changes that are not available in the GUI. Then they need to be aware the GUI will likely over ride their changes. Nicecat, You probably also won't need to edit the hosts files as the external IP of the Mac Mini should still be accessible from the LAN and the external DNS should resolve to that. – mrowell Dec 23 '09 at 1:53
The hosts file entries are for local testing. Yes use the GUI if available and it provides access to all the features available by manually editing that you need. – Matt Dec 29 '09 at 22:56

Apache, and most other webservers, can use the one IP address to respond to different domain names requests. This generally works well, unless you need SSL. Apache is the webserver used by MacOS X Server.

Apache calls this functionality Name-Based Virtual Hosts.

You easily create new virtual hosts on MacOS X Server using the Server Admin program -> Web -> Sites.

Apple provides extensive documentation on MacOS X Server at See the section "Managing Multiple Sites on One Server" of the Web Technologies Administration PDF.

And you will need an external domain name pointing to the mac mini's external IP address for each web site/domain name.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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