Red Bridge Internet is a San Francisco WordPress Consulting firm specializing in WordPress websites and WordPress Plugin Development. We're the ones you have been searching for.

How to Create a Magento Staging Site

I needed to create a Magento Staging Area for both common development tasks and testing the latest upgrades.

In order to create the staging area for my Magento store I’m going to create a mirror of it at a subdomain. I host on my own Linux server and use Godaddy to manage my domains.

My main Web site will be referred to as www.domain.com. I’ll be creating the Magento development site at dev.domain.com. Below is a step by step documentation of the steps taken to create my Magento staging area using virtual host.

Create CNAME Record:

=> login to Godaddy
=> select Domains : My Domains
=> select your domain (domain.com)
=> select Total DNS Control and MX Records
=> select Add New CNAME Record
=> enter (dev) as Alias Name
=> enter (domain.com) as Host Name

Create Staging Files:

=> copy live file directory to dev
=> run cp -R store.domain.com dev.domain.com

Create Staging Database:

=> create new Dev database
=> dump Production database
=> mysqldump –opt –user=liveuser –pass=livepass livedbname > livedbname.sql
=> load Staging database
=> mysql -u devuser -p devdbname < livedbname.sql

Setup Virtual Host in Apache:

=> locate conf file (ie httpd.conf, vhosts.conf)
=> create VirtualHost entry for dev.domain.com
=> locate apachectl
=> run ./apachectl configtest
=> run ./apachectl restart

Sync Staging Site DB Credentials:

=> editapp/etc/local.xml
=> edit lines
=> edit lines
=> edit lines

Sync Staging Site Database Settings:

=> login to MySQL dev database
=> find config to edit
=> SELECT * FROM `core_config_data` WHERE `path` LIKE ‘%base_url%’;
=> update path web/unsecure/base_url
=> update path web/secure/base_url

Cleanup Staging Site:

=> rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
=> rm -rf var/cache/* var/session/*

It might take a while to shake out the cache, but that should basically get you a Magento staging server — a snapshot of your live Magento site.

** Note: I pulled my hair out for hours trying to figure out why the dev url was not printing correctly. It just seemed that whatever I did the system wouldn’t pick up the new base_urls. What I did was restart apache which I’m assuming cleared cache and allowed for the update base_url to be picked up. Also, make sure var directory is writable.

Incoming search terms:

  • magento staging
  • magento staging server
  • magento staging websites
  • magento staging site
  • staging magento
  • magento staging environment
  • magento staging website
  • magento staging area
  • magento staging store
  • magento getorderid

Related posts:

  1. Magento Default Products Sort Order Newest
  2. Cannot Login to Frontend with Explorer on Magento Store
  3. How to Move a Joomla Site
  4. How to Install Joomla perForms Component
  5. Update Shipping Methods with osCommerce Advanced Table Rate

5 responses to “How to Create a Magento Staging Site”

  1. Jools

    I have published information with an alternative solution that means you don’t have to update the base_urls for the staging site.

    http://maglife.co.uk/2009/03/28/magento-base-urls-and-devstaging-installations/

  2. Tacitus

    …great solution! Thanks a lot! …BUT, don’t forget to modify your .htaccess file (-> RewriteBase) when you use mod_rewrite!

  3. Sean

    Thanks for the article. I have a quick question on it though. At the very end of the article you mentioned that you ” pulled my hair out for hours trying to figure out why the dev url was not printing correctly”. When you say “printing correctly” what does that mean. Did that mean the pages pulled up fine but that the URL in the browser was wrong? Or was it that you couldn’t pull of the correct pages even with the right URL in the browser?

    Thx

  4. ed

    Sean, what I think I meant was that Magento was not using the new dev url as the base url. It was stuck on using the production full url. So for instance, I could see the site at dev.store.com, but the category/page links were still using the production url.

  5. mn1423

    Hi Ed,

    In general practice what should be the time expected to built this staging server.
    What are the parameters on which this depends? Please let me know a rough time.

    Thanks
    MN.

Leave a Reply