Skip to content

Instantly share code, notes, and snippets.

@chadothompson
Created August 31, 2013 20:56
Show Gist options
  • Save chadothompson/6400588 to your computer and use it in GitHub Desktop.
Save chadothompson/6400588 to your computer and use it in GitHub Desktop.
A puppet snippet demonstrating how to create server redirects from a secondary domain to a 'real' domain. This is a local testing example that also defines the localhost (127.0.0.1) IPs to resolve to the hosts in question. (Real hostnames have been removed to protect the innocent.)
node default{
host{"myhost.com":
ip => "127.0.0.1",
}
host{"myhost2.com":
ip => "127.0.0.1",
}
host{"www.myhost.com": ip => "127.0.0.1", }
host{"www.myhost2.com": ip => "127.0.0.1", }
class{"apache": }
apache::vhost{"myhost.com":
port => 80,
docroot => "/var/www/myhost.com",
}
apache::vhost{"www.myhost.com":
port => 80,
docroot => "/var/www/myhost.com",
redirect_source => "/",
redirect_dest => "http://myhost.com",
redirect_status => "permanent",
}
apache::vhost{"myhost2.com":
port => 80,
docroot => "/var/www/myhost.com",
serveraliases => "www.myhost2.com",
redirect_source => "/",
redirect_dest => "http://myhost.com",
redirect_status => "permanent",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment