Passenger 3.0 released !2010/10/20

新規ホストのセットアップをしていて新バージョンに気付くこの体たらく……。

リリースノートによると、パフォーマンスの向上とRuby1.9.2/Rails3の正式サポートがキモなのかな?

スタンドアロン版がマージされたようですが、スタンドアロンで使うならUnicornを使うと思うので……(ry

あと、RVMの存在が感知されるようになり、apache/nginx のモジュールのコンパイル後にサジェストされるconfigがそのままコピペできるようになっています。

RVMの方でも、Passenger 2系では必須だった passenger_ruby を作成しようとすると

$ rvm 1.8.7 --passenger
If you are using Passenger 3 you no longer need the passenger_ruby,
use the wrapper script for your ruby instead (see 'rvm wrapper')

と丁寧に説明してくれるようになっています。

あとは今のところ違和感なく動作している模様。

Apache で X-Reproxy-URL2009/10/06

Apache で X-Reproxy-URL ヘッダを使えるようにするモジュール mod_reproxy を書いた - Kazuho@Cybozu Labs - via http://blog.masuidrive.jp/index.php/2009/10/04/install-mod_reproxy-to-osx/

それなりに大きなファイルをブラウザに渡す必要がある要件があったりもするので、興味あり。

あとで検証する。

X-Reproxy-URL ヘッダ自体に対する理解が薄いというか、Google先生に聞いてもあまり情報がひっかかりませんが、

APサーバからWebサーバに返却するレスポンスのヘッダにこれを仕込んでおけば良いのかな?

mod_rewrite で外部ホストへ転送(で良いのかな?)2009/06/08

mod_rewrite には 'proxy|P' (force proxy) というフラグがあるらしい

http://httpd.apache.org/docs/2.2/ja/mod/mod_rewrite.html#rewriterule

'proxy|P' (force proxy)
  This flag forces the substitution part to be internally 
  sent as a proxy request and immediately (rewrite processing stops here) 
  1put through the proxy module. You must make sure that the 
  substitution string is a valid URI (typically starting with http://hostname) 
  which can be handled by the Apache proxy module. 
  If not, you will get an error from the proxy module. 
  Use this flag to achieve a more powerful implementation 
  of the ProxyPass directive, to map remote content into 
  the namespace of the local server.

いやまあ、とあるドメインで稼動している Apache のサブディレクトリを 全く別のホストに割り当てたいという要求があって、 リバースプロキシをかけるなら mod_proxy だろJKぐらいの勢いで用意した設定を、FQDNを割り当てられているホストの管理者に投げたら 「うちのホストは mod_proxy を有効にしていないんで(ry)」みたいな返答が返ってきた。

mod_rewrite を使って欲しいと言われたのだが、mod_rewrite なんて同一ホスト内でのパスの書き換えの黒魔法ぐらいにしか使った事がないし、試しに書き換え後のアドレスにホスト名から書いてみたところ、 'redirect|R' (force redirect) のフラグの有無に関わらず、redirectになってしまう。

「んじゃ、そっちのWebサーバからAPサーバの転送ってどうやってんの?」 と教えてもらったのが、このフラグ。

だけどさ、同じセクションに

Note: mod_proxy must be enabled in order to use this flag.

と書いてあるのだが……。

SetHandler の上書き2009/05/01

Apacheの /etc/httpd/conf/httpd.conf で

<Directory /path/to/target>
  Options ExecCGI
  SetHandler cgi-script
</Directory>

な感じで設定されたCGI実行用ディレクトリに直接表示用のファイルを置きたい場合の、 当該ディレクトリの .htaccess への記述。

SetHandler None
AddHandler cgi-script .cgi

AddHandler default-handler .png
AddType image/png .png

SetHandler ディレクティブが設定されている場合は、AddHandler ディレクティブの指定より優先されてしまうので、 SetHandler None で、設定を取り消す必要がある。

後半はデフォルトなので、書かなくても良い。

ディレクトリに必要な Override 設定は

AllowOverride FileInfo

見えてはいけないファイルまで見えてしまう系の穴ができやすいので注意が必要。