Apache ServerAlias

From Mac OS X Server FAQ

Jump to: navigation, search

As of Panther Server, there is no GUI method for creating a ServerAlias directive. This instructs Apache to let a website answer to different names.

As root, edit the configuration file for your website that lives in /etc/httpd/sites. The first site added has a configuration file whose name begins with 0000, then 0001, and so on. Add a ServerAlias directive right after ServerName. The example below would configure apache to display this site when a user requests my.cool.box or your.cool.box. Of course, both of these domain names need to be configured on the DNS server that is authoritative for cool.box, and pointing to the server's IP address(es) (default in OS X Server is to listen on all IPs for all sites).

<VirtualHost 42.42.42.42:80>
        ServerName my.cool.box
        ServerAlias your.cool.box
        ...
</VirtualHost>

Any time you edit apache config files by hand, it is advisable to run the following to check for syntax errors before restarting apache to load the new config.

sudo apachectl configtest

and if all is well, then this will reload the server:

sudo apachectl graceful

External References

http://httpd.apache.org/docs/mod/core.html#serveralias

If you really want to use the GUI

At present (Panther) you're limited to making separate, duplicate entries for each domain that maps to the same site.

Personal tools
Toolbox