Domains and Domain Aliases

A site can respond to many different domain names. This page shows you how to do that

Main Domain

The main domain is specified with the :domain variable

set :domain, "example.com"

This variable is set by the brightbox command using the -d option. If you don't specify a -d on the command line then :domain will default to the name of the server.

Default Alias

By default the gem system will create a domain alias for your application so that you can access it even if you haven't set up the main domain yet, or there are problems with the main domain's DNS.

The alias is:

<app name>.<server name>

so if you have an application myforum on Brightbox mybbbox-001, the default alias will be:

myforum.mybbbox-001.vm.brightbox.net

so you can get to the Rails application root with

http://myforum.mybbbox-001.vm.brightbox.net

Adding other aliases

In addition to the default alias you can add your own aliases by setting the :domain_aliases variable.

For example the modern way of specifying a website is to use the domain directly, but many people still expect to use the old www prefix. So if you set :domain to example.com, you can add the www alias as follows:

set :domain_aliases, "www.#{domain}"

If you need more than one alias, specify them as one string separated by commas:

set :domain_aliases, "www.example.com,dev.example.com"

Applying the config to your Brightbox

If you're changing these settings after doing an initial deploy of your application, you need to update the setup and restart the web server:

cap deploy:setup
cap deploy:web:reload
docs/gemv2/domains.txt · Last modified: 2009/05/08 17:04 (external edit)