You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apache2 2.4搭配mod_fcgid运行WT应用的故障排查求助

Apache2 2.4搭配mod_fcgid运行WT应用的故障排查求助

大家好,我现在在Ubuntu 23上用Apache2 2.4搭配WT(WebToolkit/Witty)开发应用,尝试通过mod_fcgid来部署,但遇到了一些问题,想请大家帮忙排查下。

先说明我的基础环境和操作:

  • 运行环境:Ubuntu 23 + Apache2 2.4 + WT
  • 编译细节:已经用libwtfcgid库编译出hello.wt,没有使用libwthttpd
  • 权限设置:给hello.wt及相关目录设置了myuser:web-data的归属,权限值为755

下面是我的核心配置文件内容:

虚拟主机配置(hello.conf)

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName hello
    ServerAlias www.hello
    DocumentRoot /var/www/localhost/htdocs/wt-examples/hello
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/localhost/htdocs/wt-examples/hello/>
        Options +ExecCGI -Indexes +FollowSymLinks +MultiViews +SymLinksIfOwnerMatch
        AllowOverride none
        Require ip 127.0.0.1
    </Directory>
</VirtualHost>

mod_fcgid配置(fcgid.conf)

<IfModule mod_fcgid.c>
    AddHandler fcgid-script .wt
    FcgidIPCDir /var/lib/apache2/fcgid
    FcgidIdleTimeout 100
    FcgidMaxProcessesPerClass 1
    FcgidInitialEnv WT_APP_ROOT=/var/www/localhost/htdocs/wt-examples/hello
    FcgidWrapper /var/www/localhost/htdocs/wt-examples/hello .wt
</IfModule>

接下来是我遇到的具体问题:

  1. 直接访问127.0.0.1时,Apache错误日志提示:

AH01276: Cannot serve directory /var/www/localhost/htdocs/wt-examples/hello/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

这个我能理解,因为目录里没有默认索引文件,而且我放了一个普通的index.html进去是可以正常显示的,说明Apache的基础访问没问题。

  1. 当我直接访问127.0.0.1/hello.wt时,错误日志变成了:

(104)Connection reset by peer: [client 127.0.0.1:37754] mod_fcgid: error reading data from FastCGI server. [client 127.0.0.1:37754] End of script output before headers: hello.wt

我自己初步分析:之前的错误可能是mod_fcgid没生效,但现在这个错误说明FastCGI已经接收到请求了,只是WT应用没有返回正确的HTTP头,所以我怀疑是不是WT的配置或者编译环节出了问题?

有没有朋友遇到过类似的情况?或者能给我一些排查方向的建议?

备注:内容来源于stack exchange,提问作者lid

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 10:50:36