Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

up vote 8 down vote accepted

Set up a virtual host. See the following docs

http://httpd.apache.org/docs/2.2/vhosts/

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

See: http://support.apple.com/kb/TA27291

e.g.

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
add comment

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 http://www.apple.com/server/macosx/resources/documentation.html. 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.

Marcus

share|improve this answer
add comment

Your Answer

 
discard

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.