i 无法使用<代码>rackup config.ru在当地操作我的固定档案。
> rackup config.ru
simpli-web/config.ru:1:in `block in <main> : uninitialized constant Rack::Static (NameError)
from
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:103:in `eval
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:103:in `new_from_string
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:94:in `load_file
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:64:in `parse_file
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:354:in `build_app_and_options_from_config
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:263:in `app
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:424:in `wrapped_app
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:326:in `block in start
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:382:in `handle_profiling
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:325:in `start
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:182:in `start
from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/bin/rackup:5:in `<top (required)>
from /Users/cesario/.rbenv/versions/3.2.2/bin/rackup:25:in `load
from /Users/cesario/.rbenv/versions/3.2.2/bin/rackup:25:in `<main>
www.un.org/Depts/DGACM/index_french.htm 档案
> ccat config.ru
use Rack::Static,
:urls => ["/images", "/js", "/css"],
:root => "public"
run lambda { |env|
[
200,
{
Content-Type => text/html ,
Cache-Control => public, max-age=86400
},
File.open( public/index.html , File::RDONLY)
]
}
添加“要求打字/静态”后的新错误
> rackup config.ru P
[2023-06-16 10:48:54] INFO WEBrick 1.8.1
[2023-06-16 10:48:54] INFO ruby 3.2.2 (2023-03-30) [arm64-darwin21]
[2023-06-16 10:48:54] INFO WEBrick::HTTPServer#start: pid=45618 port=9292
Rack::Lint::LintError: uppercase character in header name: Content-Type (Rack::Lint::LintError)
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:653:in `block in check_headers
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `each
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `check_headers
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:73:in `response
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:35:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb:27:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/common_logger.rb:43:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/content_length.rb:20:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/handler/webrick.rb:111:in `service
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread
::1 - - [16/Jun/2023:10:49:06 +0800] "GET / HTTP/1.1" 500 62691 0.0133
Rack::Lint::LintError: uppercase character in header name: Content-Type (Rack::Lint::LintError)
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:653:in `block in check_headers
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `each
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `check_headers
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:73:in `response
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:35:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb:27:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/common_logger.rb:43:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/content_length.rb:20:in `call
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/handler/webrick.rb:111:in `service
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread
::1 - - [16/Jun/2023:10:49:07 +0800] "GET /favicon.ico HTTP/1.1" 500 60056 0.0100