Ubuntu 10.04--boa Server Build-up

Source: Internet
Author: User

statement: Since the first blog post unknowingly passed a long time, very sorry not to be able to share their own things out, but because of the home company early this month layoffs, so the new things to learn to become semi-finished, helpless and changed a, has been working three weeks, and I also want to write blog share knowledge, But learn things too miscellaneous, there are semi-finished products, really do not know what as the starting point, the company has recently been doing projects, I would like to write a little bit, although I can find a lot of samples on the internet, but I feel some not all, or their own summary of things more reliable, I hope to help you, If there is a new problem, I will keep updating, well, nonsense not much to say ...

Ubuntu 10.04 Configuring the BOA Server

First, download the BOA source code (command line under root authority):

# wget http://www.boa.org/boa-0.94.13.tar.gz

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

(It is recommended to create a boa file separately before unzipping: # mkdir Boa)

Second, the installation of the necessary tools: Bison, flex;

(These two tools I also did not find out exactly what to do, in the online search only know what is the parser and scanner, I see most of the instructions on the Internet have this step)

# Apt-get Install Bison Flex

Third, generate Makefile file:

# CD BOA-0.94.13/SRC

#./configure

Iv. to ensure that make does not appear wrong, you must modify some files:

(To make it easier to understand the following steps, it is recommended to open a terminal, open the corresponding file to see the comparison )

1, the path of the BOA configuration file boa.conf set:

The path to this file should match the value of Server_root "/etc/boa" in Src/defines.h:

# cd/etc/

# mkdir Boa

# Cp/home/qiang/share/boa/boa-0.94.13/boa.conf/etc/boa-r (front is the directory where my files are located)

Then go back to BOA/SRC: # make

This will cause an error:

Util.c:100:1:error:pasting "T" and "-" does not give a valid preprocessing token

Modify Compat.h:

# vi compat.h (in edit mode:/foo# #快速找到以下语句)

Change #define TIMEZONE_OFFSET (foo) Foo##->tm_gmtoff to:

#define TIMEZONE_OFFSET (foo) foo->tm_gmtoff

Modify BOA.C:

# VI BOA.C

Comment out the following four lines:

if (setuid (0)! =-1)

{

Die ("Icky Linux kernel bug!");

}

Otherwise when you start Boa, it appears:

Boa.c:226-icky Linux Kernel bug! No such file or directory!

(Some versions do not have this hint, but I have appeared, so after the search to be resolved)

# make

Five, before starting Src/boa need to modify the configuration file:

# vi/etc/boa/boa.conf

1, modify servername Remove the note (#), modify the user nobody and group Nogroup to user 0, group 0;

2, define the Web server's file root directory, that is, set the value of DocumentRoot default to "/var/www"

# cd/var/

# mkdir www

# chmod 777 www

3, the configuration log file directory and log files:

(1) Error report errorlog default location:/var/log/boa/error_log

(2) Access report accesslog default location:/var/log/boa/access_log

# mkdir Log/boa-p (/var directory)

# chmod 777 Log/boa-r

# Touch Error_log/touch Access_log

(These two files can help you see the Access status information for the post-operation browser)

4, the CGI program storage:

# vi/etc/boa/boa.conf

Change the last line scriptalias/cgi-bin/usr/lib/cgi-bin/to:

Scriptalias/cgi-bin/var/www/cgi-bin (for storing. cgi files)

(It is recommended to create the Cgi-bin folder when the WWW folder is created under Web development, and then the entire WWW file can be directly sent to CP after the later run)

To start the BOA server:

Switch to the source directory of the initial decompression: # CD src/

#./boa

PS-E See if there is a boa process, if none, check the error report, if prompted:

[23/apr/2012:23:58:59 +0000] boa.c:194-unable to bind:address already on use

This sentence indicates that the port is occupied, the BOA server default port is 80, such as the default port of the Ngix server is also 80, so there will be the occurrence of this situation, in order to avoid this error, we generally modify the port is 8080:

# vi/etc/boa/boa.conf

Change port 80 to port 8080

At this time again ps-e view process, if the existence of Boa proves successful! OK, kill the process reboot and test!

Six, the test procedure:

Build index.html file under/var/www/: # VI index.html (can't insert, only paste as below)

<! DOCTYPE html>

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>

<title>this is a test program!</title>


<body>

<br/>

<br/>

<a href= "./cgi-bin/test.cgi" >to CGI page!</a>

</body>

# Mkdir/var/www/cgi-bin-r

# CD Cgi-bin

# VI TEST.c

Include <stdio.h>

int main ()

{

printf ("content-type:text/html\n\n");//This sentence must exist;

printf ("

printf ("<font style=\" color:red;font-size:30px;\ ">hello cgi!</font><br/>");

printf ("<a href=\"). /index.html\ ">return index.html</a>");

printf ("</body>

return 0;

}

# gcc Test.c-o test.cgi

Then open the browser, enter the virtual machine address or 127.0.0.1:8080 (the port number has been changed), so you can see the page just written ...

Ubuntu 10.04--boa Server Build-up

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.