Passenger
提供: sha.ngri.la
Passengerをインストール
$ gem install 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 9 seconds 2 gems installed
passenger-install-apache2-module実行する
$ passenger-install-apache-module
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.
で、Enterキーを押しながら進めていく。
途中で、必要なソフトウェアがインストールされていないと
Checking for required software... * Checking for C compiler... Found: yes Location: /usr/bin/cc * Checking for C++ compiler... Found: yes Location: /usr/bin/c++ * Checking for Curl development headers with SSL support... Found: no Error: Cannot find the `curl-config` command. * Checking for OpenSSL development headers... Found: yes Location: true * Checking for Zlib development headers... Found: yes Location: true * Checking for Apache 2... Found: yes Location of httpd: /usr/sbin/httpd Apache version: 2.2.15 * Checking for Apache 2 development headers... Found: no * Checking for Rake (associated with /home/****/.rbenv/versions/2.1.1/bin/ruby)... Found: yes Location: /home/****/.rbenv/versions/2.1.1/bin/ruby /home/****/.rbenv/versions/2.1.1/bin/rake * Checking for OpenSSL support for Ruby... Found: yes * Checking for RubyGems... Found: yes * Checking for Ruby development headers... Found: yes Location: /home/****/.rbenv/versions/2.1.1/include/ruby-2.1.0/ruby.h * Checking for rack... Found: yes * Checking for Apache Portable Runtime (APR) development headers... Found: no * Checking for Apache Portable Runtime Utility (APU) development headers... Found: no Some required software is not installed. But don't worry, this installer will tell you how to install them. Press Enter to continue, or Ctrl-C to abort. -------------------------------------------- Installation instructions for required software * To install Curl development headers with SSL support: Please install it with yum install libcurl-devel * To install Apache 2 development headers: Please install it with yum install httpd-devel * To install Apache Portable Runtime (APR) development headers: Please install it with yum install apr-devel * To install Apache Portable Runtime Utility (APU) development headers: Please install it with yum install apr-util-devel If the aforementioned instructions didn't solve your problem, then please take a look at the Users Guide:
と表示されるので、指示通りにインストールする。
インストール後、再度$ passenger-install-apache-module
を実行すると、最後に、次のようなメッセージが表示されます。
(****は、ユーザ名)
Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /home/****/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/****/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/passenger-4.0.53 PassengerDefaultRuby /home/****/.rbenv/versions/2.1.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! 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: /home/****/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/passenger-4.0.53/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.conf
を編集します。
production mode
で動かすのが前提となっているので、development mode
で動かすには、RailsEnv development
を追加する必要があります。
<VirtualHost *:80> RailsEnv development 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>