Configuring Apache Server for Wt Examples
Added by Ted Smith about 15 years ago
I have been unable to get the Wt 3.1.1 examples to work with my Apache server on slackware 13.0. I am using mod_fastcgi version 2.4.6.
When running example, bobsmith.wt, the Apache error-log shows:
stat: No such file or directory
Document root ("") not valid.
This is an error message from the bobsmith.wt executable complaining about the (effective) command-line arguments when it is executed by Apache. (At least I think this is true).
My Apache config-file (/etc/httpd.conf) contains a DocumentRoot directive that works for simple html files, but bobsmith.wt fails. Some of the directives in my Apache config-file are:
DocumentRoot /srv/httpd/htdocs
AddHandler fastcgi-script wt
#FastCgiServer /var/www/htdocs/wt-examples/bobsmith/bobsmith.wt
I have commented-out the FastCgiServer line (which was recommended in Wt Install Notes) and added the AddHandler line because with FastCgiServer, my firefox browser just offered to let me get a copy of binary-file bobsmith.wt. Now with AddHandler, I get the error mentioned above.
Any ideas?
Thanks.
Replies (2)
RE: Configuring Apache Server for Wt Examples - Added by Ted Smith about 15 years ago
Amendment:
Now I think that what I originally thought, is unlikely. Now I think bobsmith.wt needs an environment variable rather than a command-line argument. Apache can set environment variables with the SetEnv directive.
How should the environment variable (or command-line arg) be set?
Thanks.
RE: Configuring Apache Server for Wt Examples - Added by Wim Dumon about 15 years ago
It seems you linked against the wthttp connector instead of the wtfcgi connector.
Open CMakeCache.txt and find 'FCGI_CONNECTOR', it should be 'ON'. Find 'EXAMPLES_CONNECTOR', it should be 'wtfcgi'. Change to if needed. Niormally, you would pass these options to cmake while configuring: cmake .. -DFCGI_CONNECTOR=ON -DEXAMPLES_CONNECTOR=wtfcgi
Linking against the wthttp connector will cause the executables to be stand-alone web servers. You can just start them (with parameters ---docroot=. ---http-server=0.0.0.0 ---http-port=8080), no need for apache. wthttp is generally recommended to use (easier to debug, fully asynchronous http server, better supported server push).