FastCGI で Wt アプリと連携するように Apache をセットアップするのに苦労しています。
Arch Linux と Apache 2.4.7 を使用しています。gcc 4.9.0 20140604
最も単純な例であるhello worldの例では、コンパイル後に次のエラーが表示されます。
[Thu Sep 11 22:46:01.208926 2014] [fastcgi:error] [pid 27628] (101)Network is unreachable: [client 127.0.0.1:52788] FastCGI: failed to connect to server "/xxx/hello/hello.wt": connect() failed, referer: http://local.hello/
[Thu Sep 11 22:46:01.208992 2014] [fastcgi:error] [pid 27628] [client 127.0.0.1:52788] FastCGI: incomplete headers (0 bytes) received from server "/xxx/hello/hello.wt", referer: http://local.hello/
これが私がすることです:
コンパイル:
$ g++ -o hello.wt hello.cpp -lwtfcgi -lwt
私の仮想ホスト:
<VirtualHost *:80>
ServerAdmin admin@xxx.com
DocumentRoot "/xxx/hello"
ServerName local.hello
ErrorLog "/var/log/httpd/local.hello-error_log"
CustomLog "/var/log/httpd/local.hello-access_log" common
<Directory /xxx/hello/>
Options All
Require all granted
</Directory>
FastCgiExternalServer /xxx/hello/hello.wt -host 127.0.0.0:9090
</VirtualHost>
そして、httpd.conf から含まれている私の fastcgi.conf:
<IfModule fastcgi_module>
AddHandler fastcgi-script .wt
# FastCgiIpcDir /tmp/fcgi_ipc/ # DOESN'T COMPILE WITH THIS UNCOMMENTED
FastCgiConfig -idle-timeout 100 -maxClassProcesses 1 -initial-env WT_APP_ROOT=/tmp
</IfModule>
私がそれをコンパイルした場合:
$ g++ -o hello.wt hello.cpp -lwthttp -lwt
そしてそれを実行します:
$ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090
すべてが正常に動作するので、Apache/fastcgi のセットアップに問題があると考えています。
すべてのヒントは大歓迎です。