8 Virtual Hosting

Virtual Hosting with SkunkWeb is a relatively simple matter. Mostly what you do is use Scope statements in the configuration file to affect the documentRoot and the compileCacheRoot. Good practice dictates that you should probably change the componentCacheRoot also. If you have numServers set to something other than zero, you should change failoverComponentCacheRoot and failoverRetry in the Scope statement.

For example: you want to serve both foo.com and bar.com sites. First you choose which is the ``default'' server, i.e. if you were to hit the server with just the IP address and no name, which you would get.

documentRoot = '/usr/local/skunk/docroot/foo.com'
compileCacheRoot = '/usr/local/skunk/cache/foo.com'

Scope(Host('bar.com',
    documentRoot = '/usr/local/skunk/docroot/bar.com',
    compileCacheRoot = '/usr/local/skunk/cache/bar.com',
))

Or alternatively, you could set the ``global'' documentRoot and compilecacheRoot to something entirely different and have an additional Scope statement to handle foo.com.

All of this applies regardless of whether you are using Apache/mod_skunkweb or the httpd service.