1

同じアプリを使用したいサブドメイン「staging.website.com」と「website.com」がありますが、環境モードは「クローズド」と「ステージング」が異なります。

Apache で次の vHost をセットアップしています。

<VirtualHost 46.17.91.215:80>
  ServerName staging.website.com
  RackEnv staging 
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /home/website/public_html/public   
  <Directory /home/website/public_html/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
  </Directory>
</VirtualHost>

<VirtualHost 46.17.91.215:80>
  ServerName website.com
  ServerAlias www.website.com
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /home/website/public_html/public
  RackEnv closed    
  <Directory /home/website/public_html/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
  </Directory>
</VirtualHost>

*明らかに、実際のドメインを「website.com」で偽装しています。

RackEnv仮想ホストのセットが異なっていても、どちらもアクセス時に同じ環境を使用します。これは同じドキュメント ルートによるものだと思いますが、達成可能である必要があります。

私も試してみましたRailsEnv

4

2 に答える 2

2

今後の参考のために、ここで答えを見つけました:https://groups.google.com/forum/?fromgroups#!topic/phusion-passenger/IKULD5QeLDw

Phusion Passenger identifies your application by its path. It
recognizes demo.example.com and example.com as the same app, so the
used RailsEnv will be whichever gets started first.

You can solve this issue by pointing both domains to different paths.
These paths may even be symlinks; Phusion Passenger doesn't resolve
them. So you can create a symlink /var/www/apps/myapp-demo, which
points to /var/www/apps/myapp, and point demo.example.com's
DocumentRoot to /var/www/apps/myapp-demo/public.
于 2013-05-17T09:14:22.547 に答える