本番環境の設定ができている前提です。
またPassengerを使っています。
環境設定ファイルの作成
$ cp config/environments/production.rb config/environements/staging.rb
deviseの:confirmableを設定している場合↓
$ vim config/environments/staging.rb
——
config.action_mailer.default_url_options = { :host => 'http://hoge.com' }
——
データベースの設定
$ vim config/database.yml
——
staging:
<<: *default
database: hoge_development
#database: hoge_staging
#database: hoge_production
——
apacheの設定
stagingサーバーに入ります
$ ssh STAGING_SERVER
>>> @ staging server
$ sudo vim /etc/httpd/conf/httpd.conf
—
RailsEnv staging
—
データベースのマイグレーション
$ rake db:migrate RAILS_ENV=staging