Ruby on rails 3 Ubuntu-Apache-Rails-Passenger-spoking错误
我有一个错误,乘客抱怨:Ruby on rails 3 Ubuntu-Apache-Rails-Passenger-spoking错误,ruby-on-rails-3,ubuntu,apache2,passenger,spawning,Ruby On Rails 3,Ubuntu,Apache2,Passenger,Spawning,我有一个错误,乘客抱怨: *** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220): Could not start the spawn server: /usr/local/rvm/gems/ruby-1.9.3-head/ruby: No such file or directory (2) [ pid=8970 thr=139698295748416 file=ext/apache2/Hooks.cpp:8
*** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/local/rvm/gems/ruby-1.9.3-head/ruby: No such file or directory (2)
[ pid=8970 thr=139698295748416 file=ext/apache2/Hooks.cpp:865 time=2012-11-07 17:17:32.422 ]: Unexpected error in mod_passenger: Cannot spawn application '/www/lensfinder.se/ruby/lensfinder': Could not read from the spawn server: Connection reset by peer (104)
Backtrace:
in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:750)
in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:297)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:566)
据我所知,尽管它存在,但它无法访问/www/lensfinder.se/ruby/lensfinder
我在网上找到了这个常见问题
问题是,当我尝试使用该命令时
passenger-config --root
我明白了:
-bash: /usr/bin/passenger-config: ruby: bad interpreter: No such file or directory
apache配置:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-head/ruby
<VirtualHost 10.0.0.37:80>
ServerAdmin webmaster@compartment.se
DocumentRoot /www/lensfinder.se/htdocs
ServerName lensfinder.se
Redirect 301 / http://www.lensfinder.se/
ErrorLog /var/log/apache2/lensfinder.se-error.log
CustomLog /var/log/apache2/lensfinder.se-access.log combined
</VirtualHost>
<VirtualHost 10.0.0.37:80>
ServerAdmin hostmaster@compartment.se
ServerName lensfinder.se
ServerAlias www.lensfinder.se
ServerAlias *.lensfinder.se
# DocumentRoot /www/lensfinder.se/htdocs
DocumentRoot /www/lensfinder.se/ruby/lensfinder/script
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /www/lensfinder.se/htdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /www/lensfinder.se/cgi-bin/
<Directory "/www/lensfinder.se/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AllowOverride AuthConfig
#Options Includes
#Options FollowSymLinks
#Options +Indexes +Multiviews +FollowSymLinks
</Directory>
<Directory "/www/lensfinder.se/htdocs/usage">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AllowOverride AuthConfig
#Options Includes
#Options FollowSymLinks
#Options +Indexes +Multiviews +FollowSymLinks
</Directory>
ErrorLog /var/log/apache2/lensfinder.se-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/lensfinder.se-access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
Alias /ruby/ /www/lensfinder.se/ruby/lensfinder/script
<Directory /www/lensfinder.se/ruby/lensfinder/script>
# Options ExecCGI
# AddHandler cgi-script .cgi
# Addhandler fastcgi-script .fcgi .fcg .fpl
AllowOVerride all
Order allow,deny
Allow from all
</Directory>
<IfModule passenger_module>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/gems/ruby-1.9.3-head/ruby
</IfModule>
RailsEnv production
RailsBaseURI /script
#
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary
</Location>
</VirtualHost>
LoadModule乘客舱/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.12/ext/apache2/mod乘客舱
PassengerRoot/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.12
PassengerRuby/usr/local/rvm/wrappers/ruby-1.9.3-head/ruby
服务器管理员webmaster@compartment.se
DocumentRoot/www/lensfinder.se/htdocs
ServerName lensfinder.se
重定向301/http://www.lensfinder.se/
ErrorLog/var/log/apache2/lensfinder.se-error.log
CustomLog/var/log/apache2/lensfinder.se-access.log组合
服务器管理员hostmaster@compartment.se
ServerName lensfinder.se
ServerAlias www.lensfinder.se
ServerAlias*.lensfinder.se
#DocumentRoot/www/lensfinder.se/htdocs
DocumentRoot/www/lensfinder.se/ruby/lensfinder/script
选项如下符号链接
允许超越所有
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融
ScriptAlias/cgi-bin//www/lensfinder.se/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
AllowOverride AuthConfig
#选项包括
#选项如下符号链接
#选项+索引+多视图+FollowSymLinks
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
AllowOverride AuthConfig
#选项包括
#选项如下符号链接
#选项+索引+多视图+FollowSymLinks
ErrorLog/var/log/apache2/lensfinder.se-error.log
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog/var/log/apache2/lensfinder.se-access.log组合
别名/doc/“/usr/share/doc/”
选项索引多视图跟随符号链接
不允许超限
命令拒绝,允许
全盘否定
允许从127.0.0.0/255.0.0.0::1/128开始
别名/ruby//www/lensfinder.se/ruby/lensfinder/script
#选项执行CGI
#AddHandler cgi script.cgi
#Addhandler fastcgi脚本.fcgi.fcg.fpl
允许超越所有
命令允许,拒绝
通融
PassengerRoot/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.12
PassengerRuby/usr/local/rvm/gems/ruby-1.9.3-head/ruby
RailsEnv生产
RailsBaseURI/script
#
#插入过滤器
SetOutputFilter放气
#Netscape 4.x有一些问题。。。
浏览器匹配^Mozilla/4 gzip纯文本/html
#网景4.06-4.08还有一些问题
浏览器匹配^Mozilla/4\.0[678]无gzip
#MSIE伪装成网景,但它很好
#BrowserMatch\bMSIE!没有gzip!仅限gzip文本/html
#注意:由于Apache 2.0.48之前的mod_setenif中存在错误
#上面的正则表达式不起作用。您可以使用以下命令
#获得所需效果的变通方法:
浏览器匹配\bMSI[E]!没有gzip!仅限gzip文本/html
#不要压缩图像
setEnvifLocase请求\u URI\
\(?:gif | jpe | g | png)$无gzip不变
#确保代理不会提供错误的内容
#标头附加变量用户代理env=!不要改变
好的,我猜您把乘客指错了目录。您应该将其指向Rails应用程序的public
目录
以下是您的项目的最低配置,位于/etc/apache2/sites available/lensfinder.se
:
<VirtualHost 10.0.0.37:80>
ServerAdmin hostmaster@compartment.se
ServerName lensfinder.se
ServerAlias *.lensfinder.se
DocumentRoot /www/lensfinder.se/ruby/lensfinder/public
RailsEnv production
<Directory "/www/lensfinder.se/ruby/lensfinder/public">
Options FollowSymLinks
AllowOverride All
Options -MultiViews
</Directory>
</VirtualHost>
然后simlink您的virtualhost配置以启用它:
ln -s /etc/apache2/sites-available/lensfinder.se /etc/apache2/sites-enabled/lensfinder.se
当然,重新启动apache2除了,在我的情况下,即使在编辑配置文件之后,我仍然无法加载Apache,因为模块仍然配置为加载以前的(全局)。因此
文件
我发现
/usr/local/rvm/gems/[YOUR-RUBY-VER]/gems/passenger-[YOUR-passenger-VER]/ext/apache2/
目录中有源文件和脚本,但没有二进制文件。但是,提供了构建这些脚本的脚本。只需运行sudo/usr/local/rvm/gems/ruby-[YOUR-ruby-VER]/gems/passenger-[YOUR-passenger-VER]/bin/passenger-install-apache2-module
我们可以查看此虚拟主机的apache配置吗?@AnthonyAlberto-是的,请查看更新的答案!您的配置实际上很混乱。。。包含Rails应用程序的文件夹在哪里?@AnthonyAlberto-/www/lensfinder.se/ruby/lensfinder当然,但这应该放在一般的/etc/apache2/apache2.conf
中,而我上面所做的配置放在/etc/apache2/sites available
中,然后在sites enabled
中模拟链接文件,这是做itOk的标准方法,但是如果我有不使用passenger的虚拟主机,如果我将其添加到通用配置中,这不是一个问题吗?一点也不,如果它不是Rails应用程序,passenger将不会处理它。但是,如果您有其他Rails应用程序,不想让passenger处理它们,而是使用unicorn或其他什么,请使用RailsAutoDetect off
,请参阅此处的文档:如果我有多个具有不同ruby版本的站点,…?从passenger 3.2开始,您将能够为每个虚拟主机切换ruby版本。。。虽然它还没有发布,仍然处于预览
状态,但显然它已经发布了,所以您可以对它进行测试
ln -s /etc/apache2/sites-available/lensfinder.se /etc/apache2/sites-enabled/lensfinder.se