The world's third largest Web server-nginx application in embedded systems (ARM processors)

Source: Internet
Author: User

This article as the old technical person to National Day (2014.10.01) of the tribute, limited open, belong to the studio 5 A-level confidential documents, do not provide technical advice:

Nginx ("Engine X") as the world's third largest Web server, if it can be applied to embedded systems in the application of what a wonderful thing, the following will tell you the possibility of implementation (by verifying) the minimum hardware configuration (300Mhz ARM9,128MB memory).

1. Cross-compiling the PCRE library ,Nginx is dependent on the PCRE library, PCRE (perl Compatible Regular Expressions) is a Perl library, including a Perl-compatible regular expression library. These are useful when performing regular expression pattern matching with the same syntax and semantics as Perl 5.

Download: pcre-8.30.tar.bz2 (refer to place Road strength:/home/fqheda/xt-linux/lxt5/eweb/eweb-v3.0.3/)

TAR-JXVF pcre-8.30.tar.bz2

CHMOD-RF 777 pcre-8.30

CD pcre-8.30

./configure CC=ARM-LINUX-GCC--host=arm-linux--prefix=/home/nginx

Make

Make install

2. Cross-compiling Nginx,nginx not much to explain, assuming "you know."
Download: nginx-1.0.15.tar.gz (refer to place Road strength:/home/fqheda/xt-linux/lxt5/eweb/eweb-v3.0.3/)

TAR-ZXVF nginx-1.0.15.tar.gz

CHMOD-RF 777 nginx-1.0.15

CD nginx-1.0.15

Patching:

Patch A:nginx-1.0.15\auto\cc\conf

Case $NGX _cc_name in
ARM-LINUX-GCC)
# Modify by xinting
# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2

patch b-1:nginx-1.0.15\auto\types\sizeof

----------------------------------------
Checking for $ngx _type size

END
# # Modify by xinting
Ngx_size=4

patch b-2:nginx-1.0.15\auto\types\sizeof

         # # Modify by Xinting
        # #ngx_test = "$CC $CC _test_flags $CC _aux_flags \
& nbsp;       ngx_test= "gcc $CC _test_flags $CC _aux_flags \
                           -o $NGX _autotest $NGX _autotest.c $ Ngx_ld_opt $ngx _feature_libs "

        # #eval" $ngx _test >> $NGX _ Autoconf_err 2>&1 "

       
         # #if [-X $NGX _autotest]; Then
        ##   ngx_size= ' $NGX _autotest '
         ##    echo "$ngx _size bytes"
        # #fi

Patch C:Nginx-1.0.15\auto\feature
Yes
#/bin/sh is used to intercept "killed" or "Abort trap" messages
# #if/bin/sh-c $NGX _autotest >> $NGX _autoconf_err 2>&1; Then
echo "Found"
Ngx_found=yes

If Test-n "$ngx _feature_name"; Then
Have= $ngx _have_feature. Auto/have
Fi
# # Modify by xinting
# #else
# # echo "found but isn't working"
# #fi
;;

Patch D:nginx-1.0.15\configure

If Test-z "$NGX _platform"; Then
echo "Checking for OS"

# #NGX_SYSTEM = ' uname-s 2>/dev/null ' # # Modify by xinting
# #NGX_RELEASE = ' Uname-r 2>/dev/null '
# #NGX_MACHINE = "arm" # # ' Uname-m 2>/dev/null '

patch e:nginx-1.0.15\src\os\unix\ngx_time.h

#include <time.h>//Modify by xinting
#include <ngx_config.h>
#include <ngx_core.h>

patch F:nginx-1.0.15\src\os\unix\ngx_errno.h

#define Ngx_ecanceled ecanceled
#define NGX_EILSEQ EILSEQ
#define Ngx_enomorefiles 0
#define NGX_SYS_NERR 1//Modify by xinting

Cross-compiling:

Export CC=ARM-LINUX-GCC
Export LD=ARM-LINUX-LD
Export Ar=arm-linux-ar
Export Ngx_system=linux
Export NGX_RELEASE=3.2-XT5
Export Ngx_machine=arm

CD nginx-1.0.15

Make clean

./configure--with-google_perftools_module--with-http_stub_status_module--prefix=/home/nginx--with-pcre=/home/ fqheda/xt-linux/lxt5/eweb/eweb-v3.0.3/pcre-8.30--with-cc-opt= "-o2-wall-wpointer-arith-i/home/nginx/include"-- with-ld-opt= "-l/home/nginx/lib"

Make Cpu=arm

Make install

To hit the installation package:

Cd/home

TAR-JCVF nginx.tar.bz2 nginx

3. Installation and operation of Nginx (ARM Board development Platform)

NGINX.TAR.BZ2 extracted to the ARM board Linux Shell Console home folder;

Directional nginx Dynamic Library location: Export ld_library_path=/home/nginx/lib: $LD _library_path

Start Nginx:/home/nginx/sbin/nginx-c/home/nginx/conf/nginx.conf

Note: Before testing (HTTP://ARM_BOARD_IP), please carefully understand the configuration file nginx.conf (may need to modify), this transplant has been in the country nearly thousands of internet of things (embedded) devices on the good running (equivalent to each device installed a small website), Do not easily doubt the correctness of the transplant!

(Author Feng Qinghua, embedded Studio (www.xteda.com)-CEO)

< reprint please note the name of the route >

The world's third largest Web server-nginx application in embedded systems (ARM processors)

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.