Embedded Web Server--goahead Migration Summary

Source: Internet
Author: User
Tags create directory

Preface

In an embedded device, you can use the Web to access the device, view the running status of the device, and make the parameter settings, similar to the router settings, without a liquid crystal display. There are a lot of comments online about the pros and cons of various web servers, and this is not discussed here, but some of the main points of the Goahead under Linux are introduced.

Porting environment

Arm + Linux 2.6, cross compiler ARM-UCLIBC-GCC

Porting Essentials

1, the SRC directory under the certs, Utils, goahead-openssl directories are deleted.

2. Move the osdep.h inside the OSDEP to the outer src.

3, the goahead-linux-default-me.h copy to the SRC directory, renamed to Me.h.

4, configure the me.h, add two lines at the beginning, indicating the running environment.

#define __ARM__       1#define __linux__     1

5, do not need SSL, the me.h two macros are set to 0.

#define ME_COM_OPENSSL 0#define Me_com_ssl 0

6, need to print more running information, the ME.H macro me_goahead_logfile from stderr:0 to Stderr:2.

#define ME_GOAHEAD_LOGFILE "stderr:0" #define Me_goahead_logfile "Stderr:2"

7, Setlocalhost call gethostbyname may be failed, resulting in a failure to run, directly not called.

8, Route.txt need to change, the route Uri=/cgi-bin handler=cgi changed to Route uri=/cgi-bin dir=./web handler=cgi, Represents the Cgi-bin directory under the Web directory.

9, Cgihandler to comment out the chdir (dir), or can not find the program under Cgi-bin, so the use of relative path to find the CGI program.

10, write makefile, compile the executable file goahead.

CC=ARM-UCLIBC-GCC#CC=GCC #-werrorflags =-wall-fpic-g-o2-s-ldl-lm-o source_file = *.cgoahead: $ (SOURCE_FILE)         $ ( CC) $ (FLAGS)  [email protected]  $ (source_file) Clean:         rm-rf goahead. Phony:clean

11, deployment, create directory/mnt/goahead, put the compiled executable program Goahead in this directory, Goahead directory and then create a web directory, This directory holds some Web-related content (such as index.html,css,image, etc.) and creates a Cgi-bin directory under the Web directory for CGI applications.

12./goahead execution can see the following information indicating the success of the operation

Goahead:1: This system does not has IPV6 Supportgoahead:2: Configuration for embedthis goaheadgoahead:2:------------- --------------------------------goahead:2: Version:            3.4.9goahead:2: BuildType:          debuggoahead:2: CPU:                Armgoahead:2: OS:                 linuxgoahead:2: Host:               0.0.0.0goahead:2: Directory:          /mnt/kas/programgoahead:2: Documents:          webgoahead:2: Configure:          me-d-q-platform linux-x86-default-configure.-with Openssl-gen Makegoah Ead:2:---------------------------------------------goahead:2: Started http://*:80goahead:2: ^^ ^^ ^^ ^^ ^^ ^ Web Start Successful ^^ ^^ ^^ ^^ ^^ ^

13, enter the IP in the browser to see, request Goahead cgitest program, the visible server printing information goahead:2: get/cgi-bin/cgitest http/1.1, the page displayed on the browser as shown.

Embedded Web Server--goahead Migration Summary

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.