我有Apache(-v):
Server version: Apache/2.0.63 Server built: Nov 29 2009 15:23:34 Cpanel::Easy::Apache v3.2.0 rev4899
我想开始新的Sinatra在乘客的应用程序。 我刚刚安装了乘客gem。 所以现在我需要设置Apacheconfiguration。
在httpd.conf中,服务器上的其他应用程序有很多设置。 所以我不能用passenger-install-apache2-module重新安装apache。 我需要与乘客build立存在的Apache 。 我现在做了什么?
第一步:以root身份运行passenger-install-apache2-module 。 这将安装需要的乘客模块。
第二步: passenger-install-apache2-module脚本会告诉你要添加到httpd.conf的内容。 添加它。 它不应该影响你正在运行的任何其他应用程序。
第三步:对于每个Ruby on Rails或Sinatra应用程序,在Apache中进行configuration。 我为Sinatra应用程序做这个:
<VirtualHost *:80> ServerName hman.flame.org DocumentRoot /www/hman/current/public ExpiresDefault "access plus 10 years" </VirtualHost>
然后我有自动检测到的/www/hman/current config.ru 。
对于Rails应用程序:
<VirtualHost *:80> ServerName art.waywardgypsy.com DocumentRoot /www/waywardgypsy-art/current/public ExpiresDefault "access plus 10 years" </VirtualHost>
然后,我使用Capistrano将Rails应用程序部署到/www/waywardgypsy-art 。
在这两种情况下, .../current/public目录都具有静态的文件,如图像,CSS等。这些文件直接由Apache提供。 Passenger查看虚拟主机的configuration并检查Sinatra或Rails,如果find合适的configuration文件,则将其视为适当的应用程序框架。
乘客不会影响没有Sinatraconfiguration文件( config.ru )或Rails( config/boot.rb )的虚拟主机。