Boa is a very small Web server with only about 60KB of executable code. As a single-task Web server, Boa can only complete the user's request in turn without fork out a new process to process the concurrent connection request. But Boa supports CGI, which is able to fork out a process for CGI programs to execute. Boa's design goals are speed and safety.
below to introduce you to the BOA server transplant specific steps, I hope to be helpful.
Environment
Host: ubuntu8.10
Cross tool chain: gcc-3.4.5-glibc-2.3.6
Target: s3c2410 Development Board
Combined with some online documents, a relatively complete document was compiled.
1. Download Boa Source
: http://www.boa.org/
Latest release version: 0.94.13
Download boa-0.94.13.tar.gz
Unzip: # tar Xzf boa-0.94.13.tar.gz
2. installation requires Tools Bison,flex
sudo apt-get install Bison flex
Otherwise, the following error will occur
MAKE:YACC: Command not found
Make: * * [Y.TAB.C] Error 127
Make:lex: Command not found
Make: * * [LEX.YY.C] Error 127
3. Modify the file
(1) Modify Src/compat.h
Found it
#define TIMEZONE_OFFSET (foo) foo##->tm_gmtoff
Modified into
#define TIMEZONE_OFFSET (foo) (foo)->tm_gmtoff
Otherwise, an error will occur:
Util.c:100:1: error:pasting "T" and "-" does not give a valid preprocessing token make: * * * [UTIL.O] Error 1
(2) Modify SRC/LOG.C
Comment out
if (Dup2 (error_log, stderr_fileno) = =-1) {
Die ("Unable to dup2 the error log");
}
For:
/*if (Dup2 (error_log, stderr_fileno) = =-1) {
Die ("Unable to dup2 the error log");
}*/
Otherwise, an error will occur:
log.c:73 Unable to dup2 the error Log:bad file descriptor
(3) Modify SRC/BOA.C
Comment out the following two words:
if (passwdbuf = = NULL) {
Die ("Getpwuid");
}
if (Initgroups (passwdbuf->pw_name, passwdbuf->pw_gid) = =-1) {
Die ("initgroups");
}
For
#if 0
if (passwdbuf = = NULL) {
Die ("Getpwuid");
}
if (Initgroups (passwdbuf->pw_name, passwdbuf->pw_gid) = =-1) {
Die ("initgroups");
}
#endif
Otherwise, an error occurs: Boa.c:211-getpwuid:no such file or directory
Comment out the following statement:
if (setuid (0)! =-1) {
Die ("Icky Linux kernel bug!");
}
For
#if 0
if (setuid (0)! =-1) {
Die ("Icky Linux kernel bug!");
}
#endif
Otherwise, the problem occurs: Boa.c:228-icky Linux kernel bug!: No such file or directory
4. Generate Makefile File
Perform:
#cd BOA-0.94.13/SRC
#./configure
5, modify the Makefile
CD src
Vim Makefile
Modify CC = gcc to cc = ARM-SOFTFLOAT-LINUX-GNU-GCC
Modify CPP = GCC-E to CC = ARM-SOFTFLOAT-LINUX-GNU-GCC-E
6. Compiling
Make
Ls-l boa
-rwxr-xr-x 1 David David 189223 2009-05-31 13:44 boa
Then for the resulting binary file Boa slimming
Arm-softfloat-linux-gnu-strip boa
Ls-l boa
-rwxr-xr-x 1 David David 61052 2009-05-31 13:51 boa
We can see that the size of the BOA gap is large, which saves us a lot of space.
7, the configuration of Boa
This step of the work is also done on the computer host.
There is already an example boa.conf under the boa-0.94.13 directory that can be modified on its basis. As follows:
#vi boa.conf
(1) Changes to Group
Modify Group Nogroup
For Group 0
(2) Modification of user
Modify User Nobody
For User 0
(3) Modification of Scriptalias
Modify Scriptalias/cgi-bin//usr/lib/cgi-bin/
For scriptalias/cgi-bin//www/cgi-bin/
(5) Modification of Doucmentroot
Modify Doucmentroot/var/www
To Doucmentroot/www
(6) Settings for servername
Modify #servername Www.your.org.here
For ServerName Www.your.org.here
Otherwise, the error "Gethostbyname::no such file or directory" will appear
(7) Accesslog modification
Modify Accesslog/var/log/boa/access_log
To #accesslog/var/log/boa/access_log
Otherwise, an error message appears: "Unable to dup2 the error Log:bad file descriptor"
(8) The following configuration is related to the configuration of boa.conf, which is created in the arm root file system
The following steps are performed on the Development Board:
Create directory/etc/boa and copy boa and boa.conf to this directory
Mkdir/etc/boa
Create the home directory for the HTML document/WWW
Mkdir/www
Create a CGI script on record/www/cgi-bin
Mkdir/www/cgi-bin
The following steps are performed under Ubuntu:
Copy the boa.conf to the/etc/boa of the Development Board root file system
#cp Boa.conf/source/rootfs/etc/boa
Copy Boa to the/etc/boa of the Development Board root file system
#cp Src/boa/source/rootfs/etc/boa
Copy ubuntu down/etc/mime.types to the dev board root filesystem/etc
#cp/etc/mime.types/source/rootfs/etc
Copy your homepage index.html to the WWW directory
8. Testing
Open a browser input board IP look at the effect
Ok
Boa Server porting