Port The Boa Server of the arm Development Board

Source: Internet
Author: User
Tags small web server

Boa is a very small Web server with only about 60 kb of code to be executed. As a single-task web server, BOA can only complete user requests in sequence, rather than fork new processes to process concurrent connection requests. However, BOA supports CGI and can execute a process for the CGI program fork. Boa is designed to speed and security.

The following describes how to port A Boa Server.

Environment

HOST: fedaro 9

Objective: To develop the mini2440 Development Board

A complete document is prepared based on some documents on the Internet.

1. Download Boa Source Code

: Http://www.boa.org/

Latest release: 0.94.13

Download boa-0.94.13.tar.gz

Unzip: # tar-xvzf boa-0.94.13.tar.gz

2. Go to Boa-0.94.13

CD/Boolean-0.94.13

CD src/

 

3. Modify the file

(1) Modify src/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

(2) Modify src/log. c

Comment out

If (dup2 (error_log, stderr_fileno) =-1 ){

Die ("unable to dup2 the error log ");

}

Is:

/* If (dup2 (error_log, stderr_fileno) =-1 ){

Die ("unable to dup2 the error log ");

}*/

Otherwise, an error occurs:

Log. C: 73 unable to dup2 the Error Log: Bad file deor

(3) Modify src/boa. c

Comment out the following two sentences:

If (passwdbuf = NULL ){

Die ("getpwuid ");

}

If (initgroups (passwdbuf-> pw_name, passwdbuf-> pw_gid) =-1 ){

Die ("initgroups ");

}

Is

# If 0

If (passwdbuf = NULL ){

Die ("getpwuid ");

}

If (initgroups (passwdbuf-> pw_name, passwdbuf-> pw_gid) =-1 ){

Die ("initgroups ");

}

# Endif

Otherwise, the following 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 !");

}

Is

# If 0

If (setuid (0 )! =-1 ){

Die ("icky Linux kernel bug !");

}

# Endif

Otherwise, a problem occurs: boa. C: 228-Icky Linux kernel bug! : No such file or directory

4. Generate the MAKEFILE file

Run:

# Cd BOA-0.94.13/src

#./Configure

5. Modify makefile

CD SRC

Gedit makefile

Modify cc = GCC to CC = arm-Linux-gcc

Modify CPP = gcc-e to CC = arm-Linux-gcc-e.

6. Compile

Make

Ls-l Boa

-Rwxr-XR-x 1 David 189223 Boa

Then we reduced BOA for the generated binary file.

Arm-Linux-strip Boa

Ls-l Boa

-Rwxr-XR-x 1 David 61052 Boa

We can find that there is a large gap between BOA and BOA, which saves us a lot of space.

7. BOA Configuration

This step is also done on the Computer Host.

An example boa. conf already exists in the BOA-0.94.13 directory and can be modified based on it. As follows:

# Vi boa. conf

(1) group Modification

Modify group nogroup

Group 0

(2) User Modification

Modify user nobody

User 0

(3) Modify alias

Modify alias/cgi-bin // usr/lib/cgi-bin/

Alias/cgi-bin // www/cgi-bin/

(5) doucmentroot Modification

Modify doucmentroot/var/WWW

Is doucmentroot/WWW

(6) servername settings

Modify # servername www.your.org. Here

Servername www.your.org. Here

Otherwise, the error "gethostbyname: no such file or directory" appears"

(7) accesslog Modification

Modify accesslog/var/log/BOA/access_log

Is # accesslog/var/log/BOA/access_log

Otherwise, the error message "unable to dup2 the Error Log: Bad file deor" appears"

(8) The following configurations are related to the configurations of BOA. conf, which are created in the arm root file system.

Perform the following steps on the Development Board:

Create the/etc/BOA directory and copy boa and BOA. conf to this directory.

Mkdir/etc/Boa

Create the main directory of the HTML document/WWW

Mkdir/WWW

Create a CGI script/www/cgi-bin

Mkdir/www/cgi-bin

Perform the following steps under fedaro 9:

Copy boa. conf to/etc/BOA in the root file system of the Development Board.

# Cp boa. CONF/source/rootfs/etc/Boa

Copy BOA to/etc/BOA in the root file system of the Development Board.

# Cp src/BOA/source/rootfs/etc/Boa

Copy/etc/mime. Types under fedaro 9 to/etc under the root file system of the Development Board.

# Cp/etc/mime. types/source/rootfs/etc

Copy your homepage index.html to the WWW directory

8. Test

Kermit runs the boa program.

Open a browser and enter the Development Board IP address to see the effect.

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.