Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 之前没有插入这样的中间件:ActionDispatch::Static(RuntimeError),仅在使用Nginx时插入_Ruby_Nginx_Ruby On Rails 5_Passenger_Passenger Nginx - Fatal编程技术网

Ruby 之前没有插入这样的中间件:ActionDispatch::Static(RuntimeError),仅在使用Nginx时插入

Ruby 之前没有插入这样的中间件:ActionDispatch::Static(RuntimeError),仅在使用Nginx时插入,ruby,nginx,ruby-on-rails-5,passenger,passenger-nginx,Ruby,Nginx,Ruby On Rails 5,Passenger,Passenger Nginx,我正在尝试在docker容器中与乘客一起使用nginx。 如果我使用passenger standalone启动rails应用程序,它将正常工作: bundle exec passenger start --engine=builtin --max-pool-size=6 --min-instances=3 但是,如果我尝试将nginx用于同一个rails应用程序,则会出现以下错误: App 21674 output: Using /usr/local/rvm/gems/ruby-2.6.6

我正在尝试在docker容器中与乘客一起使用nginx。 如果我使用passenger standalone启动rails应用程序,它将正常工作:

bundle exec passenger start --engine=builtin --max-pool-size=6 --min-instances=3
但是,如果我尝试将nginx用于同一个rails应用程序,则会出现以下错误:

App 21674 output: Using /usr/local/rvm/gems/ruby-2.6.6
App 21674 output: I, [2020-09-14T05:02:50.855329 #21674]  INFO -- sentry: ** [Raven] Raven 2.13.0 ready to catch errors
App 21674 output: I, [2020-09-14T05:02:51.103254 #21674]  INFO -- : Installing Passenger worker loop.
App 21674 output: Error: The application encountered the following error: No such middleware to insert before: ActionDispatch::Static (RuntimeError)
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/actionpack-5.2.4.1/lib/action_dispatch/middleware/stack.rb:108:in `assert_index'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/actionpack-5.2.4.1/lib/action_dispatch/middleware/stack.rb:75:in `insert'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/configuration.rb:71:in `block in merge_into'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/configuration.rb:70:in `each'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/configuration.rb:70:in `merge_into'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:509:in `block in app'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:506:in `synchronize'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:506:in `app'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:32:in `instance_exec'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:32:in `run'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
App 21674 output:     /usr/local/rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:60:in `run_initializers'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/application.rb:361:in `initialize!'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/railtie.rb:190:in `public_send'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/railtie.rb:190:in `method_missing'
App 21674 output:     /home/app/webapp/config/environment.rb:7:in `<top (required)>'
App 21674 output:     config.ru:3:in `require'
App 21674 output:     config.ru:3:in `block in <main>'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/rack-2.1.2/lib/rack/builder.rb:71:in `instance_eval'
App 21674 output:     /home/app/webapp/vendor/ruby/2.6.0/gems/rack-2.1.2/lib/rack/builder.rb:71:in `initialize'
App 21674 output:     config.ru:1:in `new'
App 21674 output:     config.ru:1:in `<main>'
App 21674 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `eval'
App 21674 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `preload_app'
App 21674 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App 21674 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:378:in `run_block_and_record_step_progress'
App 21674 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 21674 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 21674 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2020-09-14 05:02:52.8967 20550/Tt age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/app/webapp: The application encountered the following error: No such middleware to insert before: ActionDispatch::Static (RuntimeError)
  Error ID: 24ac5443
  Error details saved to: /tmp/passenger-error-iabMgj.html

[ E 2020-09-14 05:02:52.9028 20550/Tc age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 3-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 24ac5443. Please see earlier logs for details about the error.
有什么想法吗

编辑

oot@0c78d3e01f5b:/home/app/webapp# bundle exec rake middleware
I, [2020-09-14T08:22:47.642428 #27056]  INFO -- sentry: ** [Raven] Raven 2.13.0 ready to catch errors
use Raven::Rack
use Rack::Sendfile
use FontAssets::Middleware
use ActionDispatch::Static
use ActionDispatch::Executor
use Dragonfly::CookieMonster
use ActiveSupport::Cache::Strategy::LocalCache::Middleware
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use ActionDispatch::RemoteIp
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::Callbacks
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ContentSecurityPolicy::Middleware
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Rack::TempfileReaper
use Warden::Manager
use Rack::Deflater
use GitRevisionMiddleware
use ScoutApm::Middleware
use OmniAuth::Builder
use OmniAuth::Builder
use OmniAuth::Strategies::Facebook
run MYRAILSAPP::Application.routes
root@0c78d3e01f5b:/home/app/webapp# RAILS_ENV=production bundle exec rake middleware
I, [2020-09-14T08:23:09.023311 #27289]  INFO -- sentry: ** [Raven] Raven 2.13.0 ready to catch errors
use Raven::Rack
use Rack::Sendfile
use FontAssets::Middleware
use ActionDispatch::Static
use ActionDispatch::Executor
use Dragonfly::CookieMonster
use ActiveSupport::Cache::Strategy::LocalCache::Middleware
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use ActionDispatch::RemoteIp
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::Callbacks
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ContentSecurityPolicy::Middleware
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Rack::TempfileReaper
use Warden::Manager
use Rack::Deflater
use GitRevisionMiddleware
use ScoutApm::Middleware
use OmniAuth::Builder
use OmniAuth::Builder
use OmniAuth::Strategies::Facebook
run MYRAILSAPP::Application.routes
移除宝石

这是因为在actionDispatch:Static之前调用了font\u中间件

还请注意,fon_assets gem仅在资产未在生产中预编译的情况下才起作用。参考。如果使用nginx预编译和提供资产,请参考配置删除gem

这是因为在actionDispatch:Static之前调用了font\u中间件


还请注意,fon_assets gem仅在资产未在生产中预编译的情况下才起作用。参考。如果使用nginx预编译和提供资产,请参考config

config.service\u static\u文件的值是多少?您能否运行“bundle exec rake middleware”和“RAILS_ENV=production bundle exec rake middleware.”。通常情况下,使用ActionDispatch::Static
config.service\u Static\u files
值为true,
bundle-exec-rake中间件
RAILS\u ENV=production bundle-exec-rake中间件
都在工作。能否列出带生产和不带生产的bundle-exec中间件。同时尝试禁用服务静态文件请检查上面的编辑,我已将
config.serve\u-static\u文件
设置为false,还是一样的问题config.service\u static\u文件的值是多少?您能否运行“bundle exec rake middleware”和“RAILS_ENV=production bundle exec rake middleware.”。通常情况下,使用ActionDispatch::Static
config.service\u Static\u files
值为true,
bundle-exec-rake中间件
RAILS\u ENV=production bundle-exec-rake中间件
都在工作。能否列出带生产和不带生产的bundle-exec中间件。同时尝试禁用服务静态文件请检查上面的编辑,我已将
config.serve\u-static\u文件
设置为false,还是一样,非常感谢。
oot@0c78d3e01f5b:/home/app/webapp# bundle exec rake middleware
I, [2020-09-14T08:22:47.642428 #27056]  INFO -- sentry: ** [Raven] Raven 2.13.0 ready to catch errors
use Raven::Rack
use Rack::Sendfile
use FontAssets::Middleware
use ActionDispatch::Static
use ActionDispatch::Executor
use Dragonfly::CookieMonster
use ActiveSupport::Cache::Strategy::LocalCache::Middleware
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use ActionDispatch::RemoteIp
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::Callbacks
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ContentSecurityPolicy::Middleware
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Rack::TempfileReaper
use Warden::Manager
use Rack::Deflater
use GitRevisionMiddleware
use ScoutApm::Middleware
use OmniAuth::Builder
use OmniAuth::Builder
use OmniAuth::Strategies::Facebook
run MYRAILSAPP::Application.routes
root@0c78d3e01f5b:/home/app/webapp# RAILS_ENV=production bundle exec rake middleware
I, [2020-09-14T08:23:09.023311 #27289]  INFO -- sentry: ** [Raven] Raven 2.13.0 ready to catch errors
use Raven::Rack
use Rack::Sendfile
use FontAssets::Middleware
use ActionDispatch::Static
use ActionDispatch::Executor
use Dragonfly::CookieMonster
use ActiveSupport::Cache::Strategy::LocalCache::Middleware
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use ActionDispatch::RemoteIp
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::Callbacks
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ContentSecurityPolicy::Middleware
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Rack::TempfileReaper
use Warden::Manager
use Rack::Deflater
use GitRevisionMiddleware
use ScoutApm::Middleware
use OmniAuth::Builder
use OmniAuth::Builder
use OmniAuth::Strategies::Facebook
run MYRAILSAPP::Application.routes