redhat部署passenger

gem install passenger

$ sudo passenger-install-apache2-module

Installation instructions for required software

* To install Apache 2 development headers:
Please run yum install httpd-devel as root.

* To install Apache Portable Runtime (APR) development headers:
Please run yum install apr-devel as root.

* To install Apache Portable Runtime Utility (APU) development headers:
Please run yum install apr-util-devel as root.

安装上述三个库以后重新执行

$ sudo passenger-install-apache2-module

显示一些编译信息。。。

The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.17
PassengerRuby /usr/local/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

上述内容添加到/etc/httpd/conf/httpd.conf

然后添加一个Rails应用

<VirtualHost *:80>
    ServerName www.loganalysis.com
    DocumentRoot /home/admin/workspace/LogAnalysis_Online/public
    <Directory /home/admin/workspace/LogAnalysis_Online/public>
        AllowOverride all
        Options -MultiViews
    </Directory>
</VirtualHost>

重启apache

$ sudo /etc/init.d/httpd restart

如果出现没有 '/' 访问权限的问题,则修改/etc/httpd/conf/httpd.conf

User apache
Group apache

修改为

User admin
Group admin

如果在Apache配置中设置RailsEnv development,Rails将在每个请求到达以后自动reload应用

原文地址:https://www.cnblogs.com/scige/p/2721050.html