0

我有乘客抱怨的错误:

*** 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 尽管它存在。

我在Phusion 乘客网站上找到了这个常见问题解答

问题是,当我尝试使用该命令时,

passenger-config --root

我明白了:

-bash: /usr/bin/passenger-config: ruby: bad interpreter: No such file or directory

阿帕奇配置:

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>
4

2 回答 2

1

好的,我的猜测是您将Passenger 指向错误的目录。您应该将其指向publicRails 应用程序的目录。

这是您项目的极简配置/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>

然后编辑/etc/apache2/apache2.conf并在文件末尾添加:

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

然后 simlink 您的虚拟主机配置以启用它:

ln -s /etc/apache2/sites-available/lensfinder.se /etc/apache2/sites-enabled/lensfinder.se 

当然重启apache2

于 2012-11-07T16:45:00.563 回答
0

除了上一个答案之外,在我的情况下,即使在编辑配置文件之后,我仍然在加载 Apache 时遇到问题,因为该模块仍被配置为加载上一个(全局).so文件。

我发现/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

于 2013-10-30T11:01:13.830 回答