LoginSignup
6
5

More than 5 years have passed since last update.

sinatra アプリを passenger で起動するためにやったこと

Last updated at Posted at 2014-07-26

概要

bundle 便利ですよね!Sinatra で作成したアプリを訳あって passenger で動かそうとしたのですが、調べてもまとまっているサイトがあまりなかったのでまとめてみました。
意外と大した事してない。。

やったこと

passenger を Gemfile に追加

gem 'passenger'

インストール!

$ bundle install

passenger の追加モジュールをインストールする(これがないと動かない)

$ bundle exec passenger-install-apache2-module

いくつかのパッケージがないと怒られるので追加

$ sudo yum install curl-devel
$ sudo yum install ...

気を取り直してもう一度(※Enter連打)

$ bundle exec passenger-install-apache2-module

以下を httpd.conf に追加しろと言われるので追加

httpd.conf
<VirtualHost *:80>
   ServerName    www.exmaple.com
   DocumentRoot  /app_root/
   ...

   # ここから
   LoadModule passenger_module /app_root/vendor/bundle/ruby/2.0.0/gems/passenger-4.0.46/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /app_root/vendor/bundle/ruby/2.0.0/gems/passenger-4.0.46
     PassengerDefaultRuby /usr/local/bin/ruby
   </IfModule>
   # ここまで
</VirtualHost *:80>

apache の再起動して完了。

$ sudo /etc/init.d/httpd restart
6
5
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5