Changing your application's domain name

If you need to change the domain name that your application is run on, there are two basic steps you need to follow.

Firstly, you need to set up the DNS record for your new domain name.

Secondly, you need to tell Apache, on your server, that it should be watching out for requests in that new name.

Setting up your DNS Record

Once you have purchased your new domain name from your favourite registrar, you need to configure the “A Record” to point at your Brightbox's IP Address.

Reconfiguring Apache

If you are using the Brightbox Gem to deploy your application, you can reconfigure Apache as follows.

First, record your new domain name details. Open your application's config/deploy.rb file and look for a line that looks something like:

  set :domain, 'my.old.domain'

Change 'my.old.domain' to your new address.

You can also, optionally, set up alternative addresses for the same site by using the domain_aliases setting.

  set :domain_aliases, 'my.first.new.domain,my.second.new.domain'

Then, you need to upload these changes to your server, using Capistrano.

  cap deploy:setup

Lastly, you need to tell Apache to restart, so that it can pick up these new settings. Again, this can be done via Capistrano.

  cap deploy:web:reload

If you are not using the Brightbox Gem, you can edit the Apache configuration file by hand. It is located at /etc/apache2/sites-enabled/rails-YOUR-SITE-NAME. Again, Apache will need a restart to pick up the new settings.

And that should be all there is to it (apart from waiting for your DNS change to propagate).

docs/howtochangeyourdomainname.txt · Last modified: 2009/05/08 17:04 (external edit)