-
Notifications
You must be signed in to change notification settings - Fork 69
Managing additional Apache vhosts
jnewland edited this page Aug 19, 2010
·
2 revisions
If you host other sites on your server that are not managed by moonshine- perhaps they aren’t even Rails sites- you can still manage the vhost for these sites through your Moonshine manifest. For this example, let’s suppose that your Moonshine-managed application is configured for *.domain.com. The following would create a site that answered on blog.domain.com. When you see us using the “00_” prefix below, it’s to ensure that this vhost is checked for a ServerName match before the wildcard vhost. After you add this recipe to your manifest and deploy, you can upload content to the /srv/blog.domain.com directory it creates for you.
def blog_vhost
file '/srv/blog.domain.com',
:ensure => :directory,
:owner => configuration[:user]
static_vhost = <<-VHOST
<VirtualHost *:80>
ServerName managegt.com
ServerAlias blog.domain.com
DocumentRoot /srv/blog.domain.com
<Directory /srv/blog.domain.com>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RailsAutoDetect off
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch MSIE !no-gzip !gzip-only-text/html
</VirtualHost>
VHOST
file "/etc/apache2/sites-available/00_blog.domain.com",
:alias => '00_blog.domain.com',
:ensure => :present,
:content => static_vhost,
:notify => service("apache2"),
:require => file('/srv/blog.domain.com')
a2ensite "00_blog.domain.com"
end
recipe :blog_vhost