use Rack::Static, :urls => ['/stylesheets', '/images'], :root => 'public'
run proc { |env| [200, { 'Content-Type' => 'text/html', 'Cache-Control' => 'public, max-age=86400' }, File.open('public开发者_如何学运维/index.html')] }
I get private method `open' called for Rack::File:Class when I rackup. Really can't see where the problem is. Running rack 1.1. Help please...
There is a Rack::File
class, which has precedence in your rackup file because of the way Ruby looks up names. This is not the class you are looking for, you want Ruby's own File
class. That class can be referenced directly without lookup ambiguity by using the prefix ::
::File.open('public/index.html')
精彩评论