Skip to content

Customizing default virtual host

technicalpickles edited this page Nov 28, 2012 · 4 revisions

Moonshine tries to provide a good default for your Apache virtual host. You can see everything it does in the template. This should be enough for most cases, but you may need to customize it further. Rewrite rules, redirects, whatever. Fortunately, moonshine has an option for that: configuration[:passenger][:vhost_extra]. Anything you configure for that will be included in the virtual host.

Here's an example where we store the extra configuration in a template, tell moonshine to use it. In app/manifest/application_manifest.rb: class ApplicationManifest < BaseManifest

configure :passenger => { :vhost_extra => template('app/manifests/templates/vhost_extras.erb') }

recipe :default_stack

rest of your manifest

end

Anything in app/manifests/templates/vhost_extras.erb will now be rendered as a template into /etc/apache2/sites-enabled/APP.

Clone this wiki locally