Elastic Beanstalk & Rails - nginx 错误“未定义的局部变量或方法‘location_config_filename’”
Posted
技术标签:
【中文标题】Elastic Beanstalk & Rails - nginx 错误“未定义的局部变量或方法‘location_config_filename’”【英文标题】:Elastic Beanstalk & Rails - nginx error "undefined local variable or method `location_config_filename' " 【发布时间】:2018-08-14 03:21:06 【问题描述】:我正在尝试将我的 Rails5 应用程序部署到 eb 容器(独立的 ruby 2.5 乘客),但 nginx 错误仍然存在。我该怎么做才能解决这个问题?
: Completed activity. Result:
+ service passenger restart
According to the PID file '/var/app/support/pids/passenger.pid',
Phusion Passenger Standalone doesn't seem to be running.
If you know that Phusion Passenger Standalone *is* running then one of these
might be the cause of this error:
* The Phusion Passenger Standalone instance that you want to stop isn't running
on port 80, but on another port. If this is the case then you
should specify the right port with --port.
If the instance is listening on a Unix socket file instead of a TCP port,
then please specify the PID file's filename with --pid-file.
* The instance that you want to stop has stored its PID file in a non-standard
location. In this case please specify the right PID file with --pid-file.
/opt/elasticbeanstalk/support/conf/nginx_config_healthd.erb:49:in `get_binding': undefined local variable or method `location_config_filename' for #<PhusionPassenger::Standalone::StartCommand:0x000056170aa02450> (NameError)
from /opt/rubies/ruby-2.5.0/lib/ruby/2.5.0/erb.rb:885:in `eval'
from /opt/rubies/ruby-2.5.0/lib/ruby/2.5.0/erb.rb:885:in `result'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:187:in `block in write_nginx_config_file'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:180:in `open'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:180:in `write_nginx_config_file'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:42:in `start_engine_real'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:323:in `start_engine'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:63:in `run'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/src/ruby_supportlib/phusion_passenger/standalone/main.rb:51:in `run!'
from /opt/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.2.1/bin/passenger:45:in `<top (required)>'
from /opt/rubies/ruby-2.5.0/bin/passenger:23:in `load'
from /opt/rubies/ruby-2.5.0/bin/passenger:23:in `<main>'
【问题讨论】:
【参考方案1】:您的 Gemfile 中是否包含 passenger
gem?如果是这样,请确保它仅用于非生产组。 EB 预装了乘客,因此如果您将其作为应用程序的一部分进行安装,您会看到冲突。
根据经验,您可能需要拆除您的实例并重新启动它以从中恢复...
【讨论】:
其实我并没有在gemfile中添加passenger gem。 乘客版本 5 从何而来? EB 捆绑乘客版本 4。 谢谢@Brian,我曾经错误地在 gem 中添加了乘客,可能是在那个时候。 只需要一次 - 当 EB 从头开始重建您的应用程序目录/var/app/current
时,它会无限期地缓存 gem。很高兴听到你能弄明白!以上是关于Elastic Beanstalk & Rails - nginx 错误“未定义的局部变量或方法‘location_config_filename’”的主要内容,如果未能解决你的问题,请参考以下文章
apache_conf Meteor项目的Amazon Elastic Beanstalk配置文件。该文件需要保存在r的.ebconfiguration /目录中
AWS Elastic Beanstalk 500 错误 (Django) - Python-urllib/2.7 & 静态文件错误
Elastic Beanstalk & Rails - nginx 错误“未定义的局部变量或方法‘location_config_filename’”