<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/xml.xsl" type="text/xsl"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title>nulog, NULL::something : out of the headphone &gt; 2006 &gt; January &gt; 17 &gt; CGI FastCGI, ruby</title>
  <link href="http://lowreal.net/logs/2006/01/17/1"/>
  <icon>http://lowreal.net/img/banner.png</icon>
  <link rel="self" type="application/atom+xml" href="http://lowreal.net/logs/2006/01/17/1.atom"/>
  <link rel="alternate" type="application/xhtml+xml" href="http://lowreal.net/logs/2006/01/17/1.xhtml"/>
  <updated>2006-01-17T17:09:44+09:00</updated>
  <author>
    <name>cho45(砂糖)</name>
  </author>
  <id>http://lowreal.net/2006/01/17/1</id>
  <entry>
    <title>CGI FastCGI, ruby</title>
    <link rel="alternate" type="text/html" href="http://lowreal.net/logs/2006/01/17/1.html"/>
    <link rel="alternate" type="application/xml+xhtml" href="http://lowreal.net/logs/2006/01/17/1.xhtml"/>
    <updated>2006-01-17T17:09:44+09:00</updated>
    <published>2006-01-17T17:09:44+09:00</published>
    <id>http://lowreal.net/2006/01/17/1</id>
    <category term="ruby"/>
    <category term="cgi"/>
    <category term="web"/>
    <content type="xhtml" xml:base="http://lowreal.net/">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>既存のスクリプトを修正せず、そのまま fcgi 化したい。</p>
        <p>Web Server 側の設定の変更だけでいきたい。</p>
        <pre>fastcgi.server             = ( ".rb" =&gt;
                               ( "localhost" =&gt;
                                 (
                                   "socket" =&gt; "/tmp/fcgi-ruby.socket",
                                   "bin-path" =&gt; "/usr/local/bin/ruby-fcgi.rb"
                                 )
                               ))</pre>
        <p>とか書くとして (仮定)、ruby-fcgi.rb を考えたい。しかしながら FastCGI の仕組みがいまいちわかってないのでとりあえず保留。</p>
        <p>UNIX ソケットであらかじめ起動してある CGI 実行プロセスと通信する？みたいなのはわかるんだけど、実際のとこ、この <samp>bin-path</samp> に指定したプログラムと、実際にリクエストされたファイルの関係がわからない。普通の <abbr title="Common Gateway Interface">CGI</abbr> は引数にリクエストされたファイルを渡すけど、FastCGI はどうなるんだろう。というところで、試そうと思うんだけど、ちょっと環境構築に手間取っている。</p>
        <p>というか、できるなら既にそういう方法が発見できるはずなんだけど、ないってことはやっぱないんだろうか。Ruby に環境を保存しておく機能がないんだっけ。callcc ?</p>
        <ul title="読んだ">
          <li>
            <a href="http://www.rubyist.net/~matz/20040723.html#p01">Matzにっき(2004-07-23) [Ruby]既存の CGI をそのまま FastCGI 対応に</a>
          </li>
        </ul>
        <ins datetime="2006-01-17T17:52:51+09:00">
          <p>UNIX ソケットで、とは限らないようだ。TCP/IP でもできる (すなわち、別のサーバにもおける) みたい。</p>
        </ins>
        <ins datetime="2006-01-17T17:54:22+09:00">
          <p><q>普通の <abbr title="Common Gateway Interface">CGI</abbr> は引数にリクエストされたファイルを渡すけど</q> って嘘つきすぎ（ｗ</p>
          <p><abbr title="Common Gateway Interface">CGI</abbr> はただたんにリクエストされたファイルを起動してるだけだ。shebang を混同してる。</p>
        </ins>
        <ins datetime="2006-01-17T18:00:53+09:00">
          <p>うーん。よくわからん。FastCGI を使ったアプリケーションを作るたびに、<abbr>HTTPD</abbr> の設定ファイルも書き換えないといけないんだろうか。</p>
        </ins>
        <ins datetime="2006-01-17T22:28:03+09:00">
          <p><code>ENV</code> を書き換える方法がないから無理だなこれ。</p>
        </ins>
      </div>
    </content>
  </entry>
</feed>
