Migration of BOA Based on fs2410

Source: Internet
Author: User

1. Migration of the BOA Program
(1) download the Boa Source code from www.boa.org. The current version is 0.94.13. decompress it and enter the source code directory.
SRC subdirectory.
# Tar xzf boa-0.94.13.tar.gz
# Cd BOA-0.94.13/src
Generate makefile
#./Configure
(2) modify the MAKEFILE file (Note: Modify it based on your own cross compiler) and modify cc = GCC.
Cc = arm-Linux-GNU-gcc
Modify CPP = gcc-e
For CPP = arm-Linux-GNU-gcc-e
(3) modify the header fileDefines. h
Find # define server_root "/etc/boa" and change it
# Define server_root "/var/www"
The file root directory of the Web server is defined here (you can customize it as long as it is consistent with the settings in Boa. conf.
)
(4) modifySrc/compat. h
Find
# Define timezone_offset (FOO) Foo #-> tm_gmtoff
Modify
# Define timezone_offset (FOO)-> tm_gmtoff
Otherwise, an error occurs:
Util. C: 100: 1: Error: pasting "T" and "->" does not give a valid preprocessing token make: *** [util. O] Error 1
(5) modify/Src/boa. C,Comment out the following two lines :? /* If (setuid (0 )! =-1 ){
Die ("icky Linux kernel bug! ");
}*/
/* If (passwdbuf = NULL ){
Die ("getpwuid ");??
}*/
(6) gethostbyname: Resource temporarily unavailable I have also encountered this problem. I just put
If (! SERVER_NAME) {...} (probably between 266 and 286 rows) Comment out, you can run BOA on the board,
So far, I have not encountered any problems. But I don't know if there will be any problems in the future.
(7) run make to compile the program. The executable program boa is obtained, and debugging information is stripped. The final program obtained is only
62872 bytes.
# Make
# Arm-Linux-GNU-strip Boa

2. Configure BOA to support CGI program execution.
There is a boa. conf under the Boa Source Code directory.
You can modify it as follows:
48 Change User nobody to: user 0
49 Change Group nogroup to: group 0
62 errorlog/var/log/BOA/error_log comment out, add # To the front, that is, # errorlog/var/log/BOA/error_log
74 accesslog/var/log/BOA/access_log comment out, add # above
94 # Remove servername www.your.org. here #
130 directorymaker/usr/lib/BOA/boa_indexer comment out, add #
155 mimetypes/etc/mime. types: mimetypes/var/www/mime. Types
160 defaulttype text/plain: defaulttype text/html
188 comment out alias/doc/usr/Doc. Add #
193 ScriptAlias/cgi-bin // usr/lib/cgi-bin/changed to ScriptAlias/cgi-bin // var/www/cgi-bin/
Add a line below: ScriptAlias/index.html/var/www/index.html (during the test, you only need to enter the IP address to directly find the default homepage file.Index.htmlFor example, http: // 192.168.7.185 /.123
Directoryindex index.html
InstructionsIndex.htmlIs the default homepage)
Note: The last two lines indicate the location of the CGI script, and the last line indicates the location of the default homepage.

Iii. Test
First, use the mkdir WWW command under the rootfs/var directory in the NFS file system of S3C2410 to create a WWW directory. Create a cgi-bin script directory under the WWW directory, and copy the compiled executable files boa and boa. conf to the WWW directory, and then find mime under the/etc directory under the host. copy types to the rootfs/var/WWW directory.
This test environment has been set up.
The static Web Page Test and Script test are as follows:
Static web page test:
NFS Network File System on the host Board/Var/www/Vim index.html under the directory (the static webpage storage address is specified when the BoA. conf file is configured) to create a simple webpage as follows:

<HTML>
<Head> <title> BOA test </title>
</Head>
<Body>
<H1> Hello BOA </Body>
</Html>

Enter the terminal platformVar/WWWDirectory, run./Boa(Of course, you can also enable it to boot automatically, as long as it is in the root file system/Etc/inittabAddNull: Wait:/var/www/boa &Good)

[01/Jan/1970: 01: 06: 53 + 0000] BOA: Server version BOA/0.94.13
[01/Jan/1970: 01: 06: 53 + 0000] BOA: server built Sep 10 2011 at 23:11:45.
[01/Jan/1970: 01: 06: 53 + 0000] BOA: Starting server pid = 801, port 80

 

Start the browser and enter 192.168.7.185 (the default homepage path is specified at the end of the configuration file/Var/WWWAnd 123 directoryindex index.html in the BOA. conf file) (IP address of the server on the S3C2410 platform)

Test successful!

CGI Script test:
Write a simple hello. C program as follows:

# Include <stdio. h>
Int main ()
{
Printf ("Content-Type: text/html \ n"); // This is a MIME header that tells the web server that the subsequent output must be two \ n characters in the form of HTML text.
Printf ("<HTML> \ n ");
Printf ("Printf ("<body> \ n ");
Printf ("Printf ("</body> \ n ");
Printf ("Exit (0 );
}

Then perform cross-compilation to copy the hello. cgi to the Network File System./Rootfs/var/www/cgi-binDirectory
# Arm-Linux-GNU-gcc-O hello. cgi hello. c
Enter 192.168.7.185/cgi-bin/Hello. cgi in the browser
The expected page is displayed, indicating that the CGI test is successful!

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.