Project

General

Profile

Problem accessing Wt deployed with mod_fcgid on Apache 2.4

Added by Patrick Wolf almost 11 years ago

Hi,

I try in vain to get the simple Wt « hello » example running on Apache 2.4 with mod_fcgid enabled. Once I find out, I plan to design and deploy my personal website. I hope that somebody can help me.

This is my current set-up.

apache2ctl -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Apr  3 2014 12:20:28

cat /etc/apache2/mods-enabled/fcgid.conf
<IfModule mod_fcgid.c>
  AddHandler fcgid-script .wt
  FcgidIPCDir /var/lib/apache2/fcgid/sock
  FcgidConnectTimeout 20
  FcgidIdleTimeout -1
  FcgidProcessLifeTime -1
  FcgidMaxProcesses 10
  FcgidMaxProcessesPerClass 10
  FcgidMinProcessesPerClass 1

  FcgidInitialEnv WT_APP_ROOT /var/www/wt/

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

cat /etc/apache2/sites-enabled/wt.conf
<VirtualHost *:8081>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/wt

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /var/www/wt/>
            Options +ExecCGI -Indexes
            Require all granted
        </Directory>
</VirtualHost>

I compiled the source with the command from the examples directory:

cd /usr/lib/Wt/examples/hello
sudo g++ hello.C -o hello.wt -lwt -lwtfcgi -lboost_signals

and copied the resulting binary file to Apache:

sudo cp -p hello.wt /var/www/wt/

Last but not least, I created a wt subdirectory in /var/run

sudo mkdir /var/run/wt; sudo chown www-data:www-data /var/run/wt/ -R

There are no error in the Apache log

cat /var/log/apache2/error.log
...
[Sun Jun 08 22:01:55.822331 2014] [mpm_event:notice] [pid 1344:tid 139964457584512] AH00494: SIGHUP received.  Attempting to restart
[Sun Jun 08 22:01:55.829252 2014] [fcgid:info] [pid 6711:tid 139964457584512] mod_fcgid: Process manager 6711 stopped
[Sun Jun 08 22:01:55.903158 2014] [fcgid:info] [pid 7080:tid 139964457584512] mod_fcgid: Process manager 7080 started
[Sun Jun 08 22:01:55.911168 2014] [mpm_event:notice] [pid 1344:tid 139964457584512] AH00489: Apache/2.4.7 (Ubuntu) mod_fcgid/2.3.9 mod_perl/2.0.8 Perl/v5.18.2 configured -- resuming normal operations
[Sun Jun 08 22:01:55.911235 2014] [mpm_event:info] [pid 1344:tid 139964457584512] AH00490: Server built: Apr  3 2014 12:20:28
[Sun Jun 08 22:01:55.911265 2014] [core:notice] [pid 1344:tid 139964457584512] AH00094: Command line: '/usr/sbin/apache2'

We can notice that the fcgid process has started smoothly errors when reloading Apache

However it always complains that it cannot access the file in directory « wt » in /var/www/wt:

cat /var/log/apache2/access.log
...
"GET /hello.wt HTTP/1.1" 403 411 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0"

ls -l /var/www/wt/
-rwxr-xr-x 1 root root 97668 juin   8 21:48 hello.wt

I changed the UID and GID:

sudo chown www-data:www-data /var/www/wt/ -R

Same HTTP 403 error.

I am desperate and a bit ashamed not to be able to run such a trivial example. Has anyone met a similar issue? Or there is something I miss or do wrong? I haven't found any clue yet have sleepless nights since then.

Thank you for your invaluable help. I really would like to use the awesome Wt framework and also learn more out of it.

Patrick


Replies (4)

RE: Problem accessing Wt deployed with mod_fcgid on Apache 2.4 - Added by Wim Dumon almost 11 years ago

Hi,

Do you see more information in the apache error log?

BR,

Wim.

RE: Problem accessing Wt deployed with mod_fcgid on Apache 2.4 - Added by Patrick Wolf almost 11 years ago

Hi Wim,

Thank you very much for your reply. I finally managed to get it working. However, I cannot run it in my browser with the default HTTP port 80, is this normal? I have to change to another port, e.g. 8081 and add this directive to apache2.conf:

Listen 8081

Then the Hello example finally shows up in the browser.

Now I am struggling to compile the other examples :-) I assume that the provided CMakeLists.txt has to be modified to fit the environment, which does not seem to be the case as it cannot find some libraries, which are eventually installed:

CMake Error at CMakeLists.txt:13 (INCLUDE):
  include could not find load file:

    /cmake/WtFindBoost.txt


CMake Error at CMakeLists.txt:14 (INCLUDE):
  include could not find load file:

    /cmake/WtFindAsio.txt


CMake Error at CMakeLists.txt:15 (INCLUDE):
  include could not find load file:

    /cmake/WtFindGm.txt


CMake Error at CMakeLists.txt:16 (INCLUDE):
  include could not find load file:

    /cmake/WtFindSsl.txt


CMake Error at CMakeLists.txt:17 (INCLUDE):
  include could not find load file:

    /cmake/WtFindMysqlpp.txt


CMake Error at CMakeLists.txt:18 (INCLUDE):
  include could not find load file:

    /cmake/WtFindZlib.txt


CMake Error at CMakeLists.txt:19 (INCLUDE):
  include could not find load file:

    /cmake/WtFindFcgi.txt


CMake Error at CMakeLists.txt:20 (INCLUDE):
  include could not find load file:

    /cmake/WtFindGm.txt


CMake Error at CMakeLists.txt:21 (INCLUDE):
  include could not find load file:

    /cmake/WtFindHaru.txt

Cheers,

Patrick

RE: Problem accessing Wt deployed with mod_fcgid on Apache 2.4 - Added by Wim Dumon almost 11 years ago

What's your OS and how did you install Wt?

If you did an installation from source, 'cd build/examples' and then 'make' should do the trick.

Wim.

RE: Problem accessing Wt deployed with mod_fcgid on Apache 2.4 - Added by Patrick Wolf almost 11 years ago

Here is my OS:

lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:        14.04
Codename:       trusty

I installed Wt from the distribution's repository that way:

sudo apt-get install witty witty-dbg witty-dev witty-doc libwthttp-dev libboost-dev make cmake cmake-curses-gui cmake-data

I came across one of your threads in http://redmine.emweb.be/boards/2/topics/8584?page=3&r=8666 and wonder whether I should not follow your sensible suggestion, download the tar archive, unpack it in my home directory and follow the steps you mention. This would not require to compile the example sources with root privileges since they are installed by default in /usr/lib/Wt/examples.

I may also uninstall the extra cmake-curses-gui and cmake-data packages, whic I thought would be necessary. I think this would be the best approach wouldn't it?

Patrick

    (1-4/4)