2008/06/09

WMU-6500FS - Apache 2.2.8



Apache 2.2.8

Build results: [binary] [files list]

Build sequence
dev# wget http://apache.mirror.superhosting.cz/httpd/httpd-2.2.8.tar.bz2
dev# tar xvjf httpd-2.2.8.tar.bz2
dev# cd httpd-2.2.8
dev# ./configure --prefix=/mnt/C/sys/apache2 --enable-dav --enable-so --enable-maintainer-mode --enable-ssl
dev# make
dev# make install
Configuration
Info sources: [Optimizing apache]
First, we have to configure box to run apache after reboot: ... in file "/mnt/C/sys/etc/env-ng":
# if 1 then installed apache 2.2 version will be running
APACHE22=1
Then we can try to modify default apache behavior regarding to number of processes and threads (due to limited RAM of the box):
In file /usr/links/storage-C/sys/apache2/conf/extra/httpd-mpm.conf I have changed the following settings:
StartServers          1
MinSpareServers       1
MaxSpareServers       1
MaxClients            1
MaxRequestsPerChild 5000

mod_python 3.3.1

Apache module for python implemented handlers
Build results: [binary] [files list]
Info sources: [Getting ModPython Working] [Trac ModPython]

Build sequence
dev# wget http://apache.mirror.superhosting.cz/httpd/modpython/mod_python-3.3.1.tgz
dev# tar xvzf mod_python-3.3.1.tgz
dev# cd mod_python-3.3.1/
dev# ./configure --prefix=/mnt/C/sys --with-apxs=/mnt/C/sys/apache2/bin/apxs 
--with-python=/mnt/C/sys/bin/python2.5
found /usr/bin/flex, we'll use this. Use --with-flex to specify another. 
checking flex version... configure: WARNING: Flex version 2.5.4 found. 
Version 2.5.31 or greater is required. You can generally ignore this 
warning unless you need to regenerate psp_parser.c from psp_parse.l. 
If you do need regenerate psp_parser.c, use --with-flex to specify the 
location of the correct flex version. See the README for more information.

dev# make
dev# sudo make install
Create a "/mnt/C/sys/var/www/test/.htaccess" file in your subdirectory and place in it:
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
Configure www directory:
box# cd /mnt/C/sys/var/www
box# mkdir test
( box# chown  test )
box# cd test
box# echo "AddHandler mod_python .py
> PythonHandler mptest
> PythonDebug On" > .htaccess
Modify apache configuration:
box# nano /mnt/C/sys/apache2/conf/httpd.conf
In httpd.conf change following:
  User nobody
  Group nobody

  DocumentRoot "/mnt/C/sys/var/www"

  <Directory "/mnt/C/sys/var/www">
    ...
  </Directory>

  ScriptAlias /cgi-bin/ "/mnt/C/sys/var/cgi-bin/"

  <Directory "/mnt/C/sys/var/cgi-bin">
    ...
  </Directory>
... and add following (at Load modules section):
  LoadModule python_module      modules/mod_python.so
... and add following (after the root directory definition):
  <Directory "/mnt/C/sys/var/www/test">
    AllowOverride FileInfo
  </Directory>
Create test python handler "/mnt/C/sys/apache2/htdocs/test/mptest.py":
box# echo "from mod_python import apache
>
> def handler(req):
>     req.log_error('handler')
>     req.content_type = 'text/plain'
>     req.send_http_header()
>     req.write('It is working!!!\n')
>     return apache.OK
> " > /mnt/C/sys/apache2/htdocs/test/mptest.py
Test configuration (following command should show page containing string "It is working!!!"):
box# lynx localhost/test/mptest.py

6 comments:

Anonymous said...

Hi Filodej,
thanks a lot for this tutorial and for your previous answer (about using Kubuntu instead of Colinux). I have another question. I've been following your tutorial but i get some errors (for example, when i run 'make' installing Apache. I can see you have put the binary files of your work (for example http://philodej.googlepages.com/httpd-2.2.8.tgz).
Can i use this files instead of compiling all files? i would like to install deluge and nothing else (but i know there are other dependencies). Thanks in advance

Edgard

filodej said...

Hi Edgart,
yes, you can definitely use the pre-built binaries on your WMU box as well as on your chroot-ed system with uClibc library (as opposed to GNU C). See this post for info how tu set up such an environment.

I have tried to collect all the dependencies for the deluge torrent client, you can see it in this post, but unfortunately since the whole build was very lengthy process, it is possible that some of the dependencies are still missing. If you try the whole install on a clear system, please, let me know how it went so that I can update the list for others.

Thanks in advance.
Best regards,
Filodej

Anonymous said...

Hi Filodej,
thanks a lot for your reply. I got stuck when i was building the Apache files.
I don't know much about linux, but i'll try and i'll let you know if i get Deluge running

I'm planning to do this:

1.- Flash WMU box with Joker Firmware (already done w/o problems)

2.- Uncompress the binary files that you already build inside the WMU box (i'm not gonna use the chroot-ed system with uClibc library under Kubuntu)
For example:
tar xvzf binary_file

where binary_file are the following dependencies

X.Org
Gtk+
boost
python
pycairo
pygtk
atk
glade
pygobject
pyxdg
DBus
DBus-glib
DBus-python

I'll follow the order you set in your blog

3.- Modify configuration files or set environment variables (if any)

And that's all. I don't know if i can do this, or if i'm missing something. Hope this works!

Anonymous said...

Hi Filodej,

i tried what i told you before. I uncompress the binaries and i got an error like "can't load library 'librt.so.0'"
So, i uncompress libs-essential-20080502.tar.bz2 and that fixed the error. But now, when i try to run Deluge i get this error:


[root@Nas_Storage site-packages]# deluge
Traceback (most recent call last):
File "/usr/bin/deluge", line 5, in < module >
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

I couldn't see that error on your blog and couldn't find any clue to help me solve this, do you have any idea about how to dix this?
Thanks a lot, and sorry for my qustions

Edgard

filodej said...

Hello Edgart,
I have set up the Q&A post, and tried to elaborate more on this issue.

Most likely in your case following should be enough:

box# cd /mnt/C
box# wget http://peak.telecommunity.com/dist/ez_setup.py
box# python ez_setup.py

Let me know if it helps.

Kind regards,
Filodej

P.S.:
Regarding to your questions, there is no need to worry, I am glad that there is someone out there who is trying the similar things as me ;-)

Anonymous said...

Hallo, ich kann nur deutsch.

ich habe schon ein paar sachen installirt und nun bin ich bei mod_python 3.3.1.

bei mir ist das broblem,das ich nicht make ausführen kann. von was kommt das?

denn ist da noch was.
bei mir gibt es kein var/www.

habe ich irgentwas vergessen?