Boa
How install and configure the boa Web server on your board
Contents
Install
$ cd armadeus $ make menuconfig
- Select: Package Selection for the Target -> Other stuffs -> Boa
- Save the configuration
Then we can create the binaries and the default filesystem. This will be usefull later to perform the configuration :
$ make
Configure
Generalities
To apply a permanent configuration, be sure to not change anything on the board filesystem.
That would be erased the next time you flash the fs. Instead, do all changes on the filesystem
located on the host, i.e. on buildroot/project_build_arm/armadeus/root/
The boa configuration file is located in /etc/boa/boa.conf on the card
This means that to permanently change the configuration, you need to edit the file
buildroot/project_build_arm/armadeus/root/etc/boa/boa.conf on the host
Create a Dummy page
By default, DocumentRoot is set to /var/www, so let's add a dummy file here to test our configuration :
$ mkdir buildroot/build_arm_nofpu/root/var/www $ vi buildroot/build_arm_nofpu/root/var/www/index.html
And fill the file with :
<html> <head> <title> Welcome on the Armadeus Board </title> </head> <body> <h1> Welcome on the Armadeus Board </h1> </body> </html>
Enable hostname resolution
Boa has to be able to resolve the hostname to work, so let's do :
$ echo "127.0.0.1 `cat buildroot/build_arm_nofpu/root/etc/hostname`" >> buildroot/build_arm_nofpu/root/etc/hosts
Create the access log directory
By default, boa logs will be stored in /var/log/boa/ on the card. If you did not change this setting, you will need to perform the following :
$ls -l buildroot/build_arm_nofpu/root/var/log/
If this is a link to /tmp, then
$ rm -f buildroot/build_arm_nofpu/root/var/log/ && mkdir buildroot/build_arm_nofpu/root/var/log/
Then, create the boa directory :
$ mkdir buildroot/build_arm_nofpu/root/var/log/boa
Why shoud I delete the symbolink link ?
This is because during the filesystem creation, mkfs.jffs2 will keep the link from /var/log to /tmp on the board.
Thus, once on the board, you will have :
# ls -l /var/log lrwxrwxrwx 1 root root 4 Apr 15 2007 /var/log -> /tmp
With a such behavior, even if you fill the directory buildroot/build_arm_nofpu/root/var/log/ on your host (which actually fill /tmp on your host), nothing will be saved once the filesystem will be flashed on your board.
Test the result
Create the final rootfs :
$ make
Then update the rootfs on your board.
And start boa
$ boa
To access to your web page, use a browser:
http://<your IP Address>/
You sould see the page !
If not, check the file /var/log/boa/error_log on your board
Working with cgi
First, check the boa.conf file.
Once more, you should use the one located on your host before changing anything.
$ vi buildroot/build_arm_nofpu/root/etc/boa/boa.conf
Be sure to have an uncommented line like this :
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Now; let's write a dummy cgi :
$ mkdir buildroot/build_arm_nofpu/root/usr/lib/cgi-bin $ vi buildroot/build_arm_nofpu/root/usr/lib/cgi-bin/get_ipconfig.sh
And add the following :
#!/bin/sh echo -e "Content-type: text/html\r\n\r\n"; echo -e `/sbin/ifconfig eth0 | grep 'inet addr'`;
The script have to be executable:
$ chmod a+x buildroot/build_arm_nofpu/root/usr/lib/cgi-bin/get_ipconfig.sh
Then change your index.html page to add a link to the cgi:
$ vi buildroot/build_arm_nofpu/root/var/www/index.html
<html> <head> <title> Welcome on the Armadeus Board </title> </head> <body> <h1> Welcome on the Armadeus Board </h1> <br /> <br /> <a href=http://<Your IP Address>/cgi-bin/get_ipconfig.sh> Get the board ip config </a> <br /> </body> </html>
Create the new root fs :
$ make
Finally, Transfer the rootfs to the board & flash it.
You can now access to the new web page and click on the cgi link !