Hosting Multiple Websites on OS X Server

This article takes a look at how to host multiple sites in different directories on OS X Server (I have tested this on OS X 10.11 and version 5, it may well work on other versions but I can not verify this). To make these changes it is recommended that you backup the files being changed first. You will also need your favourite text editor, mine is TextWrangler.

This article assumes that you have already added your website to and set it to look at the directory in the GUI. The following needs to be done to get the directory resolving via a web browser.

Firstly you want to navigate to the following folder:


Copy the following file to your desktop:


Open the file in your text editor of choice and find the following line:

#Include /private/etc/apache2/extra/httpd-vhosts.conf

Uncomment the line so it looks like this:

Include /private/etc/apache2/extra/httpd-vhosts.conf

Save the file and move it back to the apache2 folder.

Next navigate to:


And copy the following file to your desktop:


Once open in your text editor, scroll to the end of the file and add the following (being sure to edit the paths to the path of your web directory:

<VirtualHost *:80>
DocumentRoot "/Path/On/Your/Server/Web/Directory"

<VirtualHost *:80>
DocumentRoot "/Path/On/Your/Server/Web/Directory"
ServerName fqdn.of.server
ErrorLog "/private/var/log/apache2/"
<Directory "/Path/On/Your/Server/Web/Directory">
AllowOverride All
Require all granted

You can multiple of these for however many sites you want to add. Save the file and move it back to the directory overwriting the original file.

Next navigate to:


And copy the following file to your Desktop:


Open the file and at the end of it add the record of the site you want to add, e.g: fqdn.of.server

Save it and move it back to the folder overwriting the original.

Restart the websites service in if it is already running. Open your web browser and type in the address of the website you have added, it should resolve as expected.


Print Friendly, PDF & Email