我正在努力设置 Apache 以在 FastCGI 上使用 Wt 应用程序。
我正在使用 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 设置有关。
每个提示都受到赞赏。