在观看 Railscast“#347 Rubber and 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 #...
我的宝石文件:
#...
# 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"
我的橡胶乘客.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}"
我的ruby-ruby.yml
ruby_build_version: 20131220.1
ruby_version: 2.0.0-p247
ruby_path: "/usr/local/rubies/#{ruby_version}"
有什么帮助吗?谢谢!