Score:1

How to configure fcgid.conf for Wt (Witty) C++ Web Application?

pl flag
lid

I am trying to configure fcgid.conf file for Wt (witty-web toolkit) for apache2 2.4 on Ubuntu 23. I found a config file for FastCGI (not fcgid) and convert commands to fcgid ones using apache2 web page. But one is left FastCgiServer /var/www/html/hello.wt

Here is my full code:

  AddHandler fcgid-script .wt
  FcgidIPCDir /var/lib/apache2/fcgid
  FcgidIdleTimeout 100
  FcgidMaxProcessesPerClass 1
  FcgidInitialEnv WT_APP_ROOT=/tmp
#  FastCgiServer /var/www/html/hello.wt (I want to find the equivalence for fcgid) 
  <IfModule mod_mime.c>
    AddHandler fcgid-script .fcgi
  </IfModule>
</IfModule>

How can I configure for witty? There is not enough documentation for this.

EDIT:

I changed fcgid.conf to:

<IfModule mod_fcgid.0c>
  AddHandler fcgid-script .wt
  FcgidIPCDir /var/lib/apache2/fcgid
  FcgidIdleTimeout 100
  FcgidMaxProcessesPerClass 1
  FcgidInitialEnv WT_APP_ROOT=/tmp

   <Directory /var/www/html>
       Options +ExecCGI
       FcgidWrapper /var/www/html .wt
       Order deny,allow
   </Directory>

  <IfModule mod_mime.c>
    AddHandler fcgid-script .fcgi
  </IfModule>
</IfModule>

and hello.conf file is:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName hello
    ServerAlias www.hello
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
   <Directory "/var/www/html">
      Options +ExecCGI +Indexes +FollowSymLinks -MultiViews +SymLinksIfOwnerMatch
      AllowOverride None
       Order deny,allow
  </Directory>
</VirtualHost>

No error but the the results is:

  [1]: https://i.stack.imgur.com/6B8Ep.png
Score:0
by flag

For the fcgid.conf file There is no direct equivalent of FastCgiServer in FCGI, FcgidWrapper directive is commonly used for that.

For your configuration you could use the example below, dont forget to replace /path/to/your/wt/application.

<IfModule mod_fcgid.c>
    AddHandler fcgid-script .wt
    FcgidIPCDir /var/lib/apache2/fcgid
    FcgidIdleTimeout 100
    FcgidMaxProcessesPerClass 1
    FcgidInitialEnv WT_APP_ROOT=/tmp

    <Directory /var/www/html>
        Options +ExecCGI
        FcgidWrapper /path/to/your/wt/application .wt
        Require all granted
    </Directory>
    
    <IfModule mod_mime.c>
        AddHandler fcgid-script .fcgi
    </IfModule>
</IfModule>
lid avatar
pl flag
lid
Thanks for the answer. No error but the web page loads hello.wt in an index. If I click, it just downloads it. May there be a problem with WT compilation? It takes too much to compile and I am not sure If I did it correct.
lid avatar
pl flag
lid
By the way, I haven't mention hello.wt in anywhere. How will apache know it would run hello.wt?
Saxtheowl avatar
by flag
it means that the server isn't recognizing hello.wt as a script it needs to execute. And for your second question Apache will attempt to run any *.wt file it encounters using the application specified in the FcgidWrapper directive
lid avatar
pl flag
lid
"using the application specified in the FcgidWrapper directive". Should the path of FcgidWrapper direct to an app? Currently, it is directing to hello.wt.
Saxtheowl avatar
by flag
FcgidWrapper directive should point to the compiled FastCGI application (typically a binary file), not the .wt source file, you gonna need to compile your hello.wt source file into a binary executable using a compiler
lid avatar
pl flag
lid
I had started to think what a magic way those servers were working. Now make sense. Thanks for the answer.
Saxtheowl avatar
by flag
You welcome :))
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.