2

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 のセットアップに問題があると考えています。

すべてのヒントは大歓迎です。

4

1 に答える 1

1

同様のエラーが発生しましたが、それが何であったか、別の問題があったかどうかは正確には覚えていませんが、おそらく主な問題は、/var/run/wtWt が fastcgi コネクタを使用するときにセッションを管理するために使用するフォルダーを作成していないことです。

問題は、少なくとも Ubuntu/var/runでは、tmpfs ファイルシステムを使用することです。これは、RAM に直接マウントされているため、再起動のたびに削除されるファイルシステムです。そのため、サーバーを再起動するたびに、フォルダーが存在し、適切な権限があることを確認する必要があります。

/var/run/wt別のフォルダーではないのはなぜですか?それは、wt_config.xmlファイルに設定したフォルダーによって異なります。Ubuntu 14.04 では、そのファイルは/etc/wt/wt_config.xml;の下にあります。セクション<run-directory>の下のXML タグ。<connector-fcgi>必要に応じて、そのディレクティブを変更して、別の永続フォルダーを指すようにすることができます。

ただ、私が作ったのは、起動時にフォルダを作成するinitジョブを作成し、以下の内容のファイル(スクリプト)を作成することです。/var/run/wt//etc/init/witty.confupstart

#
# This task is run on startup to create the Witty's run folder
# (currently /var/run/wt) with suitable permissions.

description     "set witty's run folder (/var/run/wt)"

start on startup

task
exec /usr/local/bin/witty_mkrunfolder

そして、私のwitty_mkrunfolder実行可能ファイルは次のとおりです。

#!/bin/bash

mkdir /var/run/wt
chown -R root:www-data /var/run/wt
chmod -R 770 /var/run/wt

エクストラ:witty_mkrunfolderパーミッション:

$ chown root:root witty_mkrunfolder
$ chmod 750 witty_mkrunfolder
于 2015-12-22T03:57:07.533 に答える