- CentOS
$ cat /etc/redhat-release
CentOS release 6.5 (Final)
- gcc-c++
- apr-devel
- apr-util-devel
- httpd
- httpd-devel
$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Apr 3 2014 23:56:16
If you don't get some modules, do below
$ sudo yum install -y gcc-c++ httpd httpd-devel apr-devel apr-util-devel
$ gem install --no-rdoc --no-ri passenger
$ passenger --version
Phusion Passenger version 4.0.41
"Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
$ cd ~
$ sudo find . -name passenger-install-apache2-module
./.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.41/bin/passenger-install-apache2-module
./.rbenv/versions/2.0.0-p451/bin/passenger-install-apache2-module
$ ./.rbenv/versions/2.0.0-p451/bin/passenger-install-apache2-module
Output some lines for deploying web application. And add these to httpd.conf.
LoadModule passenger_module /home/********/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/********/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.41
PassengerDefaultRuby /home/********/.rbenv/versions/2.0.0-p451/bin/ruby
</IfModule>
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
</Directory>
</VirtualHost>
I actually added these lines to httpd.conf
<VirtualHost *:80>
ServerName *:80
RailsEnv development
PassengerEnabled on
DocumentRoot /home/togashik/sample_app/app/public
<Directory /home/togashik/sample_app/app/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
$ sudo service httpd restart
I got fails below when executing restart httpd
Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/passenger.conf: Cannot load /home/togashik/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so into server: /home/togashik/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so: cannot open shared object file: Permission denied
So try stopping SELinux and restart httpd
$ sudo setenforce 0