さくらVPSにPhusion Passengerをインストールしました。
こんにちは!くまかけです。
Ruby on RailsのWebアプリであるRedmineを動かす為にPhusion Passengerをインストールしました。
■Phusion Passengerをインストールする
Ruby on RailsのWebアプリをApacheやnginxで動かす為のモジュール。
# gem list passenger
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
*** LOCAL GEMS *** # gem install passenger Fetching: rack-1.6.0.gem (100%) Successfully installed rack-1.6.0 Fetching: passenger-5.0.4.gem (100%) Building native extensions. This could take a while... Successfully installed passenger-5.0.4 Parsing documentation for rack-1.6.0 Installing ri documentation for rack-1.6.0 Parsing documentation for passenger-5.0.4 Installing ri documentation for passenger-5.0.4 Done installing documentation for rack, passenger after 12 seconds 2 gems installed # gem list passenger *** LOCAL GEMS *** passenger (5.0.4) |
■PassengerとApacheの連携を行う
# yum install gcc gcc-c++ libcurl-devel openssl-devel zlib-devel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Package gcc-4.4.7-11.el6.x86_64 already installed and latest version Package gcc-c++-4.4.7-11.el6.x86_64 already installed and latest version Package openssl-devel-1.0.1e-30.el6_6.5.x86_64 already installed and latest version Package zlib-devel-1.2.3-29.el6.x86_64 already installed and latest version ========================================================================================================================= Package Arch Version Repository Size ========================================================================================================================= Installing: libcurl-devel x86_64 7.19.7-40.el6_6.4 updates 245 k Installing for dependencies: libidn-devel x86_64 1.18-2.el6 base 137 k Updating for dependencies: curl x86_64 7.19.7-40.el6_6.4 updates 194 k libcurl x86_64 7.19.7-40.el6_6.4 updates 166 k Transaction Summary ========================================================================================================================= Install 2 Package(s) Upgrade 2 Package(s) |
# yum install httpd-devel apr-devel apr-util-devel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
Apache 2 development headers Apache Portable Runtime (APR) development headers Apache Portable Runtime Utility (APU) development headers ========================================================================================================================= Package Arch Version Repository Size ========================================================================================================================= Installing: apr-devel x86_64 1.3.9-5.el6_2 base 176 k apr-util-devel x86_64 1.3.9-3.el6_0.1 base 69 k httpd-devel x86_64 2.2.15-39.el6.centos base 152 k Installing for dependencies: cyrus-sasl-devel x86_64 2.1.23-15.el6_6.1 updates 303 k db4-cxx x86_64 4.7.25-18.el6_4 base 588 k db4-devel x86_64 4.7.25-18.el6_4 base 6.6 M expat-devel x86_64 2.0.1-11.el6_2 base 120 k openldap-devel x86_64 2.4.39-8.el6 base 1.1 M Updating for dependencies: cyrus-sasl x86_64 2.1.23-15.el6_6.1 updates 78 k cyrus-sasl-lib x86_64 2.1.23-15.el6_6.1 updates 136 k cyrus-sasl-plain x86_64 2.1.23-15.el6_6.1 updates 31 k db4 x86_64 4.7.25-18.el6_4 base 563 k db4-utils x86_64 4.7.25-18.el6_4 base 130 k httpd x86_64 2.2.15-39.el6.centos base 825 k httpd-tools x86_64 2.2.15-39.el6.centos base 75 k openldap x86_64 2.4.39-8.el6 base 280 k Transaction Summary ========================================================================================================================= Install 8 Package(s) Upgrade 8 Package(s) |
■Phusion PassengerのApacheモジュール版を作成してプラグインする
# passenger-install-apache2-module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
Welcome to the Phusion Passenger Apache 2 module installer, v5.0.4. 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 to select. If the menu doesn't display correctly, press '!' ‣ ⬢ Ruby ⬢ Python ⬡ Node.js ⬡ Meteor Enterします。 -------------------------------------------- Almost there! Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /opt/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.4/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /opt/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.4 PassengerDefaultRuby /opt/rbenv/versions/2.2.1/bin/ruby </IfModule> After you restart Apache, you are ready to deploy any number of web applications on Apache, with a minimum amount of configuration! Press ENTER to continue. |
入力待ちのままで、httpd.confに上記の内容を追加します。
apache2を再起動します。。。後でもいいのかな??
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
-------------------------------------------- Deploying a web application: an example Suppose you have a web application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: <VirtualHost *:80> ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public <Directory /somewhere/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: #Require all granted </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /opt/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.4/doc/Users guide Apache.html https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. |
バーチャルホストの内容をhttpd.conに追加します。
ここで間違えたんですが、redmineディレクトリの下にpublicディレクトリがあるので、そこまでをDocumentRootに指定します。
例)/opt/www/www.examin.com/public_html/redmine/public
apache2を再起動します。