1、Passenger简介
https://github.com/phusion/passenger
A fast and robust web server and application server for Ruby, Python and Node.js
https://www.phusionpassenger.com/
https://www.phusionpassenger.com/library/dev/ruby/
https://www.phusionpassenger.com/library/dev/ruby/rails_integration.html
2、Nginx和Apache
3、Passenger + Apache部署Rails
安装Apache
安装Passenger
安装过程中出现
Installation instructions for required software
* To install Curl development headers with SSL support:
Please run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever you prefer.
* To install Apache 2 development headers:
Please install it with apt-get install apache2-dev
* To install Apache Portable Runtime (APR) development headers:
Please install it with apt-get install libapr1-dev
* To install Apache Portable Runtime Utility (APU) development headers:
Please install it with apt-get install libaprutil1-dev
If the aforementioned instructions didn't solve your problem, then please take
a look at our documentation for troubleshooting tips:
https://www.phusionpassenger.com/library/install/apache/
https://www.phusionpassenger.com/library/admin/apache/troubleshooting/
按照提示,安装必要的库,重试sudo passenger-install-apache2-module
若成功,可以看到输出文字中有这样的一段话
--------------------------------------------
Almost there!
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /var/lib/gems/2.2.0/gems/passenger-5.1.2/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /var/lib/gems/2.2.0/gems/passenger-5.1.2
PassengerDefaultRuby /usr/bin/ruby2.2
</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 when you are done editing.
--------------------------------------------
修改Apache服务器配置
编辑/etc/apache2/apache2.conf
Options FollowSymLinks
AllowOverride None
#Require all denied
Require all granted
</Directory>
<IfModule mod_passenger.c>
PassengerRoot /var/lib/gems/2.2.0/gems/passenger-5.1.2
PassengerDefaultRuby /usr/bin/ruby2.2
</IfModule>
编辑/etc/apache2/ports.conf
添加应用配置文件
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /home/thinking/Documents/Aptana_Studio_3_Workspace/Tmp/MiNitPayDemo/public
RailsEnv development
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog /home/thinking/Documents/Aptana_Studio_3_Workspace/Tmp/MiNitPayDemo/error.log
CustomLog /home/thinking/Documents/Aptana_Studio_3_Workspace/Tmp/MiNitPayDemo/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
重启Apache
4、Passenger + Nginx 部署Rails