AmazonLinuxへ戻る
まず、gem コマンドで passenger をインストールします。
- Fetching: daemon_controller-1.2.0.gem (100%)
- Successfully installed daemon_controller-1.2.0
- Fetching: passenger-4.0.53.gem (100%)
- Building native extensions. This could take a while...
- Successfully installed passenger-4.0.53
- Parsing documentation for daemon_controller-1.2.0
- Installing ri documentation for daemon_controller-1.2.0
- Parsing documentation for passenger-4.0.53
- Installing ri documentation for passenger-4.0.53
- Done installing documentation for daemon_controller, passenger after 5 seconds
- 2 gems installed
次に、passenger の apache2 モジュールをインストールします。
下記のように表示されます。Enter を押下して、続行して下さい。
- Welcome to the Phusion Passenger Apache 2 module installer, v4.0.53.
- This installer will guide you through the entire installation process. It
- shouldn't take more than 3 minutes in total.
- Here's what you can expect from the installation process:
- 1. The Apache 2 module will be installed for you.
- 2. You'll learn how to configure Apache.
- 3. You'll learn how to deploy a Ruby on Rails application.
- Don't worry if anything goes wrong. This installer will advise you on how to
- solve any problems.
- Press Enter to continue, or Ctrl-C to abort.
下記のように表示されます。Ruby を選択して Enter を押下することで、続行して下さい。
- Welcome to the Phusion Passenger Apache 2 module installer, v4.0.53.
- This installer will guide you through the entire installation process. It
- shouldn't take more than 3 minutes in total.
- Here's what you can expect from the installation process:
- 1. The Apache 2 module will be installed for you.
- 2. You'll learn how to configure Apache.
- 3. You'll learn how to deploy a Ruby on Rails application.
- Don't worry if anything goes wrong. This installer will advise you on how to
- solve any problems.
- Press Enter to continue, or Ctrl-C to abort.
- --------------------------------------------
- Which languages are you interested in?
- Use <space> to select.
- If the menu doesn't display correctly, press '!'
- ?・皙◇ Ruby
- 皙・ Pythonn
- 皙・ Node.jss
- 皙・ Meteorr
httpd.conf の末尾に下記の3つの設定を追加します。
Rails を開発モードで動作するようにします。
passenger のモジュールをロードします。
VirtualHost の設定を追加します。
ec2-user の配下の rails4 ディレクトリをドキュメントルートとし、その下に Rails4 プロジェクト hapo を配置しています。
RailsBaseURI を使用することで、一つのドキュメントルートの中に複数のRails4 プロジェクトが配置できるようになります。
- <VirtualHost *:80>
- ServerName www.yourhost.com
- # !!! Be sure to point DocumentRoot to 'public'!
- #DocumentRoot /home/ec2-user/rails4/HapoCommunity/public
- DocumentRoot /home/ec2-user/rails4
- RailsBaseURI /hapo
- <Directory /home/ec2-user/rails4/HapoCommunity/public>
- Order allow,deny
- Allow from all
- # This relaxes Apache security settings.
- AllowOverride all
- # MultiViews must be turned off.
- Options -Indexes
- Options -MultiViews
- </Directory>
- </VirtualHost>