Rails使用Rubber部署到ec2:mod_passenger.so:无法打开共享对象文件

时间:2014-01-19 14:28:35

标签: ruby-on-rails deployment amazon-web-services amazon-ec2 rubber

在观看Railscast“#347 Rubber和Amazon EC2”之后,我正在尝试将一个Rails应用程序部署到Amazon ec2,在解决了之前的一些问题后,我遇到了这个错误:

  * 2014-01-19 10:14:04 executing `rubber:apache:start'
  * executing "sudo -p 'sudo password: '  bash -l -c 'service apache2 status || service apache2 start'"
    servers: ["production.foo.com"]
    [production.foo.com] executing command
 ** [out :: production.foo.com] Apache2 is NOT running.
 ** [out :: production.foo.com] * Starting web server apache2
 apache2: Syntax error on line 211 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/mods-enabled/passenger.conf: Cannot load /usr/local/rubies/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.35/ext/apache2/mod_passenger.so into server: /usr/local/rubies/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.35/ext/apache2/mod_passenger.so: cannot open shared object file: No such file or directory
 ** [out :: production.foo.com] Action 'start' failed.

我的远程apache2.conf

   208  #...
   209  # Include module configuration:
   210  Include mods-enabled/*.load
   211  Include mods-enabled/*.conf
   212  #...

我的远程/usr/local/rubies/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.35

 2  LoadModule passenger_module /usr/local/rubies/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.35/ext/apache2/mod_passenger.so
 3  PassengerRoot /usr/local/rubies/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.35
 4  PassengerRuby /usr/local/rubies/2.0.0-p247/bin/ruby
 5  PassengerUseGlobalQueue on
 6 #...

我的Gemfile:

#...
# Rubber deploy
gem 'rubber'
gem 'open4'
gem 'gelf'
gem 'graylog2_exceptions', :git => 'git://github.com/wr0ngway/graylog2_exceptions.git'
gem 'graylog2-resque'
gem 'unf'
gem "passenger", "~> 4.0.35"

我的rubber-passenger.yml

passenger_version: 4.0.35
passenger_root: "#{`bash -l -c 'find #{ruby_path} -name passenger-#{passenger_version}'`.strip}"
passenger_ruby: "#{ruby_path}/bin/ruby"
passenger_lib: "#{passenger_root}/ext/apache2/mod_passenger.so"
passenger_listen_port: 7000
passenger_listen_ssl_port: 7001
max_app_connections: 20

role_dependencies:
  passenger: [apache]

roles:
  passenger:
    packages: [apache2-mpm-prefork, apache2-prefork-dev, libcurl4-openssl-dev, libapache2-mod-xsendfile]
    gems: [fastthread, rack, [passenger, "#{passenger_version}"]]
    rolling_restart_port: "#{passenger_listen_port}"

  web_tools:
    rolling_restart_port: "#{web_tools_port}"

我的rubber-ruby.yml

ruby_build_version: 20131220.1
ruby_version: 2.0.0-p247
ruby_path: "/usr/local/rubies/#{ruby_version}"

有任何帮助吗? THKS!

1 个答案:

答案 0 :(得分:3)

看起来你错过了apache的乘客模块。

你试过Ubuntu:

sudo apt-get install libapache2-mod-passenger

或在CentOS上:

yum install mod_passenger

或只是一般安装

gem install passenger