Throwing error when browsing hello.wt
Ubuntu distribution:
Distributor ID: Neon
Description: KDE neon 6.0
Release: 22.04
Codename: jammy
Apache2 version
Server version: Apache/2.4.52 (Ubuntu)
Server built: 2024-07-17T18:57:26
Appche2 Error snippet
[2024-Aug-12 02:41:43.736] 29974 - [info] "WServer/wthttp: fatal: Document root (--docroot) was not set."
[Mon Aug 12 02:41:43.737088 2024] [fcgid:warn] [pid 29910:tid 139722038322752] (104)Connection reset by peer: [client 127.0.0.1:36194] mod_fcgid: error reading data from FastCGI server
[Mon Aug 12 02:41:43.737218 2024] [core:error] [pid 29910:tid 139722038322752] [client 127.0.0.1:36194] End of script output before headers: hello.wt
contents of the fcgi.conf
<IfModule mod_fcgid.c>
AddHandler fcgid-script .wt
FcgidIPCDir /var/lib/apache2/fcgid
FcgidIdleTimeout 100
FcgidMaxProcessesPerClass 1
FcgidInitialEnv WT_DOC_ROOT=/var/www/wt/
DocumentRoot /var/www/wt
<Directory /hello/hello.wt>
Options +ExecCGI -Indexes
FcgidWrapper "/var/www/wt/examples/hello/hello.wt --docroot=."
Require all granted
</Directory>
<IfModule mod_mime.c>
AddHandler fcgid-script .fcgi
</IfModule>
</IfModule>
contents of my site config
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin [email protected]
DocumentRoot /var/www/wt/
ServerName wt.example.com
ScriptAlias /cgi-bin/ /var/www/wt/
<Directory "/var/www/wt">
Options +ExecCGI -Indexes +FollowSymLinks +MultiViews
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Not much documentation on this, and seems I’ve gotten pretty far in this; I would not be seeing the error, if the module was not at least getting called. 🙂
The crux of this biscuit is –docroot is not being set when executing using mod_fcgid within apache2.
When starting hello.wt from the CLI in terminal, it expects –docroot, as well as –http-listen parameters passed which then starts listening. The example starts an wthttp instance listening on 0.0.0.0:8080. This all works, and my C++ code is compiled, and executes correctly in the browser.
The issue is when trying to configure mod_fcgid with the above configuration. It’s still looking for –docroot parameter. How can I set this within the configuration? or how can I compile the examples to have this preset?