WEBrick is the “slowest” webserver in Ruby, how could it possibly be webscale? To answer this question and explore Is Ruby Too Slow For Web-Scale?, we will compare WEBrick to a real piece of “webscale” tech: NGINX. While there might be some faster webservers on the market, is there a case where WEBrick is fast enough? Before we can dig into that question, let’s look at a real world deployment of W
最近、社内で Rails 関係のコードを読む会を持ち回りでやっていて、今週は僕が担当だったのだけど、Rack をもうちょっとちゃんと知りたかったので、Rack 対応の軽量サーバーである WEBrick を読んだ。pryで実行しながら読んだのだけど、流れを整理しておく。 TL; DR 具体的には、公式サイトのトップページに書かれた以下がどのように立ち上がりリクエストを処理するかを追った。 require 'rack' app = Proc.new do |env| ['200', {'Content-Type' => 'text/html'}, ['A barebones rack app.']] end Rack::Handler::WEBrick.run app
/etc/hosts を書き換えなくても気軽に特定のサーバに通信できるプロキシが欲しいと思ったんですが、意外にちょうど良いのがなかったので自作しました。 <追記> proxy.pac で十分ではという意見をブコメでいただいたんですが、やりたいのは「本番系リバースプロキシやロードバランサを通さずに特定のサーバだけに任意のタイミングでアクセスする手段」を、システムファイル書き換えを伴わずに行う方法なので今回のコンセプトとは少しばかり違うのです・・・。 </追記> るびまに Webrick でプロキシサーバの記事がある #!/usr/bin/env ruby require 'webrick' require 'webrick/httpproxy' # プロキシサーバオブジェクトを作る s = WEBrick::HTTPProxyServer.new({}) # SIGINT を捕捉する。 Si
http や https サーバをローカルにサクッと立てたい時の便利コマンド。 Local Server local に HTTP サーバを立てたい場合、よくこんなのが使われている。 ただ、あまり気に入ってなかった。 長い python のバージョンで変わる コマンドを https に変えても https サーバにはならない content-type を変えたい 特に HTTPS サーバは、 ServiceWorker 周りをいじる時に確認とかで便利なんだけど、証明書を作ったりが面倒。 ということで作り始めたコマンドが落ち着いて来たので載せておく。 http/https コマンド http か https と叩くだけでカレントにサーバが上がる。 デフォルトポートは 3000 で第一引数で指定もできる。 https は証明書の準備もいらない。 https の証明書はコマンドがその都度、自己証
We exist to give all people the freedom to belong, to connect with others, to share their passions and be accepted in a safe, trusted environment. We’re the technology and media company behind thousands of online communities and dating sites around the world. Through our portfolio of niche websites, apps and other channels, we help people live their happily ever now and build a better, more incl
Webサーバー=Apache!? 今、Webサーバーを構築しようとした時、ほとんどの人はサーバーソフトとして「Apache(Apache HTTP Server)」を選ぶと思います。 確かにApacheは非常に高機能で、通常必要と思われるほとんどの機能が備わっています。 しかし、自分用にちょっとしたサーバーを立ち上げるには、その設定項目の多さなどが少し大げさに感じることはないでしょうか? また、大抵のことは設定変更や外部で公開されているApacheモジュールなどで事足りますが、その範囲を超えてWebサーバーを拡張したい場合、自分でApacheモジュールを書かなくてはいけません。 Apacheモジュールを書こうとすると、かなりしっかりドキュメントなどを読む必要があり、また主にC言語による開発になるので、どうしても敷居が高くなってしまい、実際に書くということはほとんどないでしょう。 Apach
WEBrick is a Ruby library providing simple HTTP web servers. It uses basic access authentication and digest access authentication for different kinds of servers that it can create - HTTP based server, HTTPS server, proxy server and virtual-host server.[4] Construction of several non-HTTP servers such as the Day Time Server which uses the Daytime Protocol rather than the HTTP is also facilitated by
Support for the Ruby 2.1 series ended on March 31 2017. See here for details. webrick.rb webrick/accesslog.rb webrick/cgi.rb webrick/config.rb webrick/cookie.rb webrick/htmlutils.rb webrick/httpauth.rb webrick/httpauth/authenticator.rb webrick/httpauth/basicauth.rb webrick/httpauth/digestauth.rb webrick/httpauth/htdigest.rb webrick/httpauth/htgroup.rb webrick/httpauth/htpasswd.rb webrick/httpauth/
[edit] 要約 汎用HTTPサーバーフレームワークです。HTTPサーバが簡単に作れます。 WEBrick はサーブレットによって機能します。サーブレットとはサーバの機能をオブジェクト化したものです。ファイルを読み込んで返す・forkしてスクリプトを実行する・テンプレートを適用するなど、「サーバが行なっている様々なこと」を抽象化しオブジェクトにしたものがサーブレットです。サーブレットは WEBrick::HTTPServlet::AbstractServlet のサブクラスのインスタンスとして実装されます。 WEBrick はセッション管理の機能を提供しません。 NOTE: WEBrick は Ruby 3.0 で標準ライブラリから削除されました。Ruby 3.0 以降で WEBrick を使いたい場合は rubygems から利用してください。 WEBrick の概要 以下は Web
When you deploy a Ruby application without a Procfile, a default webserver will be used. For Rack this means $ bundle exec rackup is run for Rails $ rails server. Depending on the version of these libraries and what gems you have in your Gemfile, the WEBrick server may be used to run your production application. Even if your application does not use WEBrick, it is HIGHLY recommended you do not rel
『るびま』は、Ruby に関する技術記事はもちろんのこと、Rubyist へのインタビューやエッセイ、その他をお届けするウェブ雑誌です。 Rubyist Magazine について 『Rubyist Magazine』、略して『るびま』は、日本 Ruby の会の有志による Rubyist の Rubyist による、Rubyist とそうでない人のためのウェブ雑誌です。 最新号 Rubyist Magazine 0058 号 バックナンバー Rubyist Magazine 0058 号 RubyKaigi 2018 直前特集号 Rubyist Magazine 0057 号 RubyKaigi 2017 直前特集号 Rubyist Magazine 0056 号 Rubyist Magazine 0055 号 Rubyist Magazine 0054 号 東京 Ruby 会議 11 直
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く