?鎬俊???版??杩?绡???绔???锛???涓?澶ч?ㄥ????璐?涔頒?璁?涓虹??寮????匡???浜???绋????ユ?ラ????????涔??????т?????绋??誨??浜?杩?涓?瀹?楠???浣????????頒?涓?浜???棰?锛????ц?棰???绋?涓?姝ヤ?姝ュ??????娌℃??瀹?楠?????锛?????姝ュ????浜?涓?涓????變?浠???linux????????瑙?棰?涓?璁捐?$??NFS??浠剁郴缁??ㄥ????缂哄け锛?璇寸?戒???绋???????浠舵??浣?????褰??瑰?闆?瀹??????ㄥ????誇???浣???????涓?杩????ц?棰???绋???璇寸????寮????垮??哄????宸辮???ㄦ??杞?FS???ц?boa锛?浣??????ㄤ???????绋???灏辨病???闆?充???杞戒???NFS??浠剁郴缁?涓???锛??????版??NFS?變韓??褰???????璁や負??杞戒???NFS??浠剁郴缁???NFS?變韓??褰??????哄????????浠ュ??虹?????蹇?椤昏??宸變豢?ф??绋???宸卞?ㄥ????誇????ㄦ??浠舵??浣?锛?搴?璇?涓?澶?璇翠?锛???璧鳳?
1?????ф??绋???姝ラ?ょ??涓?姝ユ??灏?boa????缂╁??澶??跺??buntu绯葷?涓?杩?琛?瑙e??锛?澶??剁??浣?缃???宸辨?撅???渚誇?涓??版?歸?藉??浠ワ???瑕???宸辮?芥?懼?般????????缂╁???劇??浣?缃?濡?涓?锛???SH杞?浠剁?存?ユ???伴??杈瑰氨琛?锛?锛?
[email?protected]:/home/linuxsystemcode/web#
濡?涓???绀烘?????懼?ㄤ?web杩?涓???浠跺す??锛?杩?????涓?涓?杩?涓?boa????浠惰??宸卞??浠ュ??oa??瀹????闆??http://www.boa.org/)?諱?杞斤?
2???ヤ??ョ????浣?灏辨??瀵矽?涓???缂╁??杩?琛?瑙e??(杩?姝ヨ?????buntu涓???浣???)锛?
tar -vxf boa-0.94.13.tar.gz
3??瑙e????浼?????瀛?涓猴?busybox-1.22.1????浠躲??杩??ヨ?涓???浠跺す涓???src??浠跺す??锛?杩?琛?./configure????Makefile缂?璇???浠訛??蜂???浣?濡?涓?(杩?姝ヨ?????buntu涓???浣???)锛?
[email?protected]:/home/linuxsystemcode/web# cd boa-0.94.13
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13# cd src
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# ./configure
浠ヤ???浣???灏變?????涓?涓?Makefile??瀛?????浠訛???浠???寮?杩?涓???浠訛?淇??瑰?朵腑??涓や釜???幫?
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# vi Makefile
??akefile杩?涓???浠堕????绗?33琛?宸??蟲??浠ヤ?涓よ?浠g??锛?
CC = gcc
CPP = gcc -E
淇??規??浠ヤ?浠g??锛?
CC = arm-none-linux-gnueabi-gcc -static
CPP = arm-none-linux-gnueabi-gcc -E -static
?跺??
:wq
淇?瀛????猴?杈???code>make?戒護寮?濮?缂?璇?boa锛?
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# make
杩??朵??ㄦ????涓?琛???涓?涓??ラ??
make: *** [util.o] Error 1
锛??ョ??瑙e?寵?涓??ラ??锛?浣跨??i ?戒護??寮?褰?????褰?涓???compat.h杩?琛?浠g??淇??瑰?蜂???浣?濡?涓?(娉ㄦ??璺?寰?锛???涔???缂?璇??跺?????d釜??浠跺す???存?ユ??寮?compat.h??浠?锛?
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# vi compat.h
??寮???浠跺???扮??123琛?浠g??宸??蟲?懼??code>#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff涓?琛?锛??逛負濡?涓?浠g??锛?
?瑰??淇?瀛????猴??ョ??
make
缂?璇?锛?缂?璇?????浜?锛?娌℃???ラ?????跺??
ls
?ョ??涓?????????浜???涓?oa??浠訛???杩???????浜?濡?涓?锛?
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# ls
acconfig.h cgi_header.o escape.h Makefile select.c
aclocal.m4 cgi.o escape.o Makefile.in select.o
alias.c check_struct_for.m4 get.c mmap_cache.c signals.c
alias.o compat.h get.o mmap_cache.o signals.o
boa config.c globals.h parse.h sublog.c
boa.c config.cache hash.c pipe.c sublog.o
boa_grammar.y config.h hash.o pipe.o timestamp.c
boa.h config.h.in index_dir.c queue.c timestamp.o
boa_indexer config.log index_dir.o queue.o util.c
boa_lexer.l config.o ip.c read.c util.o
boa.o config.status ip.o read.o webindex.pl
buffer.c configure lex.yy.c request.c y.tab.c
buffer.o configure.in lex.yy.o request.o y.tab.h
cgi.c defines.h log.c response.c y.tab.o
cgi_header.c escape.c log.o response.o
?跺???ョ??涓?涓?boa??浠剁??澶у?锛?
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# ll boa
-rwxr-xr-x 1 root root 932735 Apr 16 04:56 boa*
涓?杈瑰?????烘??浠舵???瑰?垮ぇ锛?浣跨??code>arm-none-linux-gnueabi-strip boa?戒護缁???浠剁??韓涓?涓?锛???浣?濡?涓?锛?
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# arm-none-linux-gnueabi-strip boa
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13/src# ll boa
-rwxr-xr-x 1 root root 642340 Apr 16 04:57 boa*
??浠ョ????oa??浠跺?浜?涓?浜?锛??拌???boa缂?璇?灏卞????浜?????buntu涓?????浣?灏辨???剁???浜?锛?涓?杈圭????浣??烘???藉?ㄥ????跨??Linux绯葷?涓???浣???锛??ら??????璇存????
4?????ㄥ????匡?灏?涔???缂?璇???????????boa??浠舵?瘋??闆????跨??bin??褰?涓?(涔?灏辨??绯葷????圭??褰?)????杩??????╃?ㄥ??杈瑰?????TFTP瀹?楠??ヤ?杞藉?闆????跨??bin??褰?涓???锛?浣?浠?涔???浠ョ?????存?ユ?瘋??闆????挎??????FS??浠跺?變韓??boa??浠跺??跺?闆????跨??bin??浠跺す??锛???浣?濡?涓?(杩????????????╃??FTP????浣?锛?????buntu涓???浣???)??
????????缂?璇?????boa??浠跺??buntu涓?澶??跺?頒?Ubuntu??tftp??浠跺す??锛??逛究??杈圭???ㄥ????誇?杞借?涓???浠?????FTP??浠朵?杞藉??NFS??浠跺?變韓瀹?楠???浼?????杈矽ˉ涓?锛?????浣???宸卞?繪?ョ??涓?涓?璁?涓虹??瑙?棰????????芥????)锛?
[email?protected]:~# cd /var/tftpboot/ /*杩???灏辨??杩??ュ?版????TFTP??浠跺す??*/
[email?protected]:/var/tftpboot# cp /home/linuxsystemcode/web/boa-0.94.13/src/boa ./ /*杩???灏辨????boa??浠舵?瘋??版????TFTP??浠跺す??*/
涓??㈠氨???ㄥ????垮?╃??FTP??boa??浠朵?杞藉?闆????跨??bin??浠跺す??锛?濡???浣???宸辨?瘋???in??浜?锛?灏變???瑕?寮?杩?姝ヤ?锛?
[[email?protected]-4412]#cd bin //杩???????杩???in??浠跺す??
[[email?protected]-4412]#tftp -g -l boa -r boa 192.168.0.101 //杩???????Ubuntu涓?TFTP??浠跺す????boa??浠朵?杞藉?闆????跨??bin??
[[email?protected]-4412]#ls //?ョ???????杞芥????锛?涓?杈圭??涓?琛?绗?涓?涓?灏辨??boa锛?涓?杞芥????
ash dnsdomainname kbd_mode mv setarch
base64 dumpkmap kill netstat setserial
boa echo linux32 nice sh
busybox ed linux64 pidof sleep
cat egrep ln ping stat
catv false login ping6 stty
chattr fdflush ls pipe_progress su
chgrp fgrep lsattr printenv sync
chmod fsync lzop ps tar
chown getopt makemime pwd touch
conspy grep mkdir reformime true
cp gunzip mknod rev umount
cpio gzip mktemp rm uname
cttyhack hostname more rmdir usleep
date hush mount rpm vi
dd ionice mountpoint run-parts watch
df iostat mpstat scriptreplay zcat
dmesg ipcalc mt sed
[[email?protected]-4412]#
澶??舵??????锛?瑕??ㄥ????誇??闆緩??涓???浠躲??棣???灏辨???ㄦ?圭??褰???etc??浠跺す涓??闆緩boa??浠訛???浣?濡?涓?锛?
[[email?protected]-4412]#mkdir boa //??寤?oa??浠?
[[email?protected]-4412]#ls //?ョ??boa??浠舵??????寤烘????锛?????锛?
boa group init.d passwd rc.d
eth0-setting hosts mime.types profile resolv.conf
[[email?protected]-4412]#
?ョ??灏辨???ㄥ????跨郴缁????圭??褰?涓???寤轟?涓???涓?ww??浠訛???浣?濡?涓?锛?
[[email?protected]-4412]#cd //杩????圭??褰?
[[email?protected]-4412]#mkdir www //?闆緩www??浠?[[email?protected]-4412]#ls //?ョ???????闆緩????锛?????锛?
bin etc linuxrc proc sys tmp var
dev lib mnt sbin tftp usr www
[[email?protected]-4412]#
?跺??灏辨???ㄤ?杈規?闆緩??www??浠跺す???闆緩??涓?gi-bin??浠訛???浣?濡?涓?锛?
[[email?protected]-4412]#cd www //杩???ww??浠堕??
[[email?protected]-4412]#mkdir cgi-bin //?闆緩cgi-bin??浠?[[email?protected]-4412]#ls //?ョ???????闆緩????锛?????锛?
cgi-bin
[[email?protected]-4412]#
boa 绋?搴?杩?琛???瑕?涓?涓???缃???浠訛?boa.conf锛???buntu涓?瑙e????boa-0.94.13 ??褰?涓??㈡??涓?榛?璁ょ??boa.conf ??浠訛???瀹??瘋??闆????跨??etc/boa ??褰?涓??????浣?濡?涓?(??涓?锛???杩????╃??FTP??浣???锛???涓轟?澶?涔???杈瑰???幫?浣?涔???浠ョ?????ョ?存?ユ?瘋?????NFS??浠跺?變韓?ュ???拌?涓?姝ワ?寮虹???ㄨ??瀛?互?寸???瀛?氨??涓轟????涓??跺???骞插??锛?浣?璇村???)锛?
//杩??ュ??buntu涓?????TFTP??浠跺す??
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13# cd /var/tftpboot/
//?瘋?boa-0.94.13??浠跺す涓???boa.conf??浠跺?版????TFTP??浠跺す??锛??逛究????杈瑰?ㄥ????誇?杞?[email?protected]:/var/tftpboot# cp /home/linuxsystemcode/web/boa-0.94.13/boa.conf ./
[email?protected]:/var/tftpboot# ls //?ョ???????瘋?????锛?????锛?
boa exec getpid msgrecivc readpipe test
boa.conf execls helloexec msgsnd sig_hello writepipe
creatc fork helloworld pipe signal
[email?protected]:/var/tftpboot#
涓?杈瑰氨???ㄥ????誇?涓?杞?oa.conf??浠剁????浣?浜?锛?濡???浣???宸辨?瘋?杩??諱?锛?灏變???瑕?????杩?涓?姝ョ????浣?浜?锛?
[[email?protected]-4412]#cd etc/boa/ //??杩??拌??劇疆boa.conf????浠跺す??
[[email?protected]-4412]#tftp -g -l boa.conf -r boa.conf 192.168.0.101
[[email?protected]-4412]#ls //?ョ???????杞芥????锛?????锛?
boa.conf
[[email?protected]-4412]#
boa.conf??浠舵?瘋??闆????跨??/etc/boa涓???灏辨???ョ????Ubuntu??etc涓???mime.types?瘋??闆????跨??etc涓?(??杩???杩????ㄧ??tftp?瑰?)锛?
//杩??ュ??buntu涓?????TFTP??浠跺す??
[email?protected]:/home/linuxsystemcode/web/boa-0.94.13# cd /var/tftpboot/
//Ubuntu??etc涓???mime.types?版????TFTP??浠跺す??锛??逛究????杈瑰?ㄥ????誇?杞?[email?protected]:/var/tftpboot# cp /etc/mime.types ./
[email?protected]:/var/tftpboot# ls //?ョ???????瘋?????锛?????锛?绗?涓?琛?绗???涓?灏辨??
boa exec getpid mime.types pipe signal
boa.conf execls helloexec msgrecivc readpipe test
creatc fork helloworld msgsnd sig_hello writepipe
[email?protected]:/var/tftpboot#
?ョ??灏辨???ㄥ????誇?涓?杞?ime.types??浠剁????浣?浜?锛?濡???浣???宸辨?瘋?杩??諱?锛?灏變???瑕?????杩?涓?姝ョ????浣?浜?锛?
[[email?protected]-4412]#cd etc //??杩??拌??劇疆mime.types????浠跺す??
[[email?protected]-4412]#tftp -g -l mime.types -r mime.types 192.168.0.101
[[email?protected]-4412]#ls //?ョ???????杞芥????锛?????锛?
boa resolv.con init.d passwd rc.d
eth0-setting hosts mime.types profile
[[email?protected]-4412]#
?ョ??灏辨???ㄥ????跨??etc涓??闆緩group??浠訛?骞舵??寮?璇ユ??浠舵坊??涓?琛?
root:*:0:
??浠g??锛?淇?瀛????恒????浣?濡?涓?锛?
[[email?protected]-4412]#cd etc //??杩??拌??劇疆mime.types????浠跺す??
[[email?protected]-4412]#vi group //?闆緩group??浠跺苟??寮?
//??寮?group??锛?娣誨??root:*:0:??锛?淇?瀛?????[[email?protected]-4412]#ls //?ョ???????闆緩????锛?????锛?
boa group init.d passwd rc.d
eth0-setting hosts mime.types profile resolv.conf
[[email?protected]-4412]#
?跺??杩??闆????跨??etc/boa ??褰?锛?浣跨??i boa.conf ?戒護??寮?boa.conf ??浠朵慨?瑰??澶?浠g??锛?
??绗?涓?涓?淇??圭????璇ユ??浠剁??绗?49琛?宸??崇??
Group nogroup
淇??逛負
Group root
?$??浜?涓?淇??圭????璇ユ??浠剁??绗?96琛?宸??崇??
#ServerName www.your.org.here
淇??逛負
ServerName www.your.org.here
?㈢??涓?涓?淇??圭????璇ユ??浠剁??绗?115琛?宸??崇??
DocumentRoot /var/www??
淇??逛負
DocumentRoot /www
??杩???????/www??灏辨?????㈡?ラ?や嬌??kdir ??寤虹??www ??褰???
?f????淇??圭????璇ユ??浠剁??绗?194琛?宸??崇??
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
淇??逛負
ScriptAlias /cgi-bin/ /www/cgi-bin/
?拌???灏變慨?瑰??浜?锛?淇?瀛????恒??
5??涓??㈡坊?????ㄨ?琛?boa ??????锛???寮?寮????跨??etc/init.d/rcS??浠訛??ㄦ????涓??鋒坊??
boa &
浠g??锛?淇?瀛????恒??杩???????浣?澶у?跺?璇ラ?戒?浜??э?灏卞?蜂釜??锛??垮?褲??
6???ョ??杩??ュ?頒????闆緩??www??浠??ㄥ????跨???圭??褰?涓?)??浣跨??i index.html ?戒護寤虹??index.html ??浠跺苟灏?涓?杈圭??浠g???懼?拌?涓??闆緩????浠跺す??淇?瀛?????????浠g????html??锛?涓?璇??璇翠?锛????磋叮??宸辯?懼害浠?濞?涓?涓?)锛?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>iTOP-4412</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 36px}
body {
background-color: #996600;
}
-->
</style>
</head>
<body>
<table width="613" height="424" border="0" align="center">
<tr>
<td colspan="2" align="center" valign="middle"><h2 class="STYLE1">iTOP-4412 WEB SERVER </h2></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
?拌???灏卞ぇ??????浜?锛??ョ??灏辨???ㄥ????胯???eboot?戒護????寮????褲??
7??寮????垮???ㄨ??ュ????跨??bin涓?杩?琛?boa锛?杩??????借?琛????跺????绀烘病????锛?浣???浠ュ??淇??規??????杩?琛?锛?锛??跺??灏辨??ps?戒護涓?涓??ョ??????oa杩?琛?????浜?锛???浣?濡?涓?锛?
[[email?protected]-4412]#cd bin //杩??ュ????跨??bin涓?
[[email?protected]-4412]#chmod 777 boa //淇??規????
[[email?protected]-4412]#./boa //杩?琛?boa
[[email?protected]-4412]#ps //?ョ??boa?????ㄨ?琛?
961 nobody 0:00 boa //灏辨??杩?涓?锛???灏辮〃绀哄?ㄨ?琛?
989 root 0:00 [flush-179:0]
9636 root 0:00 [kworker/2:2]
22680 root 0:38 [kworker/0:1]
23761 root 0:00 [kworker/2:0]
25469 root 0:00 [kworker/0:2]
28175 root 0:00 [kworker/0:0]
28244 root 0:00 [kworker/2:1]
30713 root 0:00 [sh]
30714 root 0:00 [sh]
30715 root 0:00 [sh]
30722 root 0:00 ps
[[email?protected]-4412]#
濡???杩?琛???????璇?锛?浣?灏卞??浠ユ??寮??ㄥ??涓?缃?缁?涓?璁懼???娴?瑙??ㄤ?锛?杈??ヤ?寮????跨??IP?闆??锛???杩?????192.168.0.120锛?濡????虹?頒??劇???????e氨????瀹?楠?????浜?锛?
涓?杈瑰氨?????ㄤ?杩扮??瀹?楠?涓?淇??逛?浜???浠跺??楠?IO???у?訛?涔?灏辨??LED???у?訛??蜂???浣?灏變???浜?锛???浠ュ???т?杈歸?ㄥ????浣?锛?????淇??規?ラ?ゆ?寸??涓?涓?锛?
????寮????跨??www??浠朵???index.html??浠跺???ゆ?????瑰??web淇?瀛?涓?涓?(?戒護涓?code>mv index.html web.html)锛????闆緩涓?涓?index.html??浠訛???寮???浠舵??涓?杈圭??浠g?????伴??杈逛?瀛????猴?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>led杩?绋??у??lt;/title>
<style type="text/css">
body {
background-color: #999900;
text-align: center;
}
.ziti {
font-size: 24px;
}
.juzhong {
text-align: center;
}
.hsz {
text-align: center;
}
.hsz td {
color: #00F;
font-size: 18px;
}
.hsz {
background-color: #FCC;
}
.juzhong table {
text-align: center;
}
.juzhong table tr {
}
#h1 {
background-color: #0FC;
}
#h2 {
background-color: #FF9;
}
.h3 {
background-color: #0CF;
}
.ys1 {
font-size: 24px;
}
.STYLE1 {font-size: 36px}
</style>
</head>
<body class="juzhong">
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><p class="STYLE1"> </p>
<p class="STYLE1">iTOP-4412 WEB SERVER </p></td>
</tr>
<tr>
<td height="30"> </td>
</tr>
<tr>
<td><form action="/cgi-bin/myled.cgi" method="get" enctype="application/x-www-form-urlencoded" name="form1" target="_blank" id="form1">
<table width="300" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<td>Led1</td>
<td><input name="led1" type="checkbox" id="led1" value="1" />
<label for="led1"></label></td>
</tr>
<tr>
<td>Led2</td>
<td><input name="led2" type="checkbox" id="led2" value="2" />
<label for="led2"></label></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" id="submit" value="submit" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td ><p> </p> </td>
</tr>
</table>
<p> </p>
</body>
</html>
?¤??ュ??buntu涓?锛???渚垮?版?瑰??寤?yled.c???ュ?涓?浠g??锛?淇?瀛????猴?
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *data;
int leds[2] = {0, 0};
long m, n;
int exit=0,i,fd;
printf("Content-Type:text/html;charset=gb2312\n\n");
printf("<html>\n");
printf("<body>\n");
printf("<title>iTOP-4412</title> ");
printf("<h3>iTOP-4412</h3> ");
data = getenv("QUERY_STRING");
printf("<p>receive data:%s</p>",data);
while(*data != '\0')
{
if(*data=='=')
switch(*(data+1))
{
case '1':leds[0]=1;break;
case '2':leds[1]=1;break;
default:exit=1;break;
}
if(exit == 1)
break;
data++;
}
fd=open("/dev/leds",0);
for(i=0;i<2;i++)
{
if(leds[i]==1)
printf("<p>%d\t</p>",i+1);
ioctl(fd,leds[i],i);
}
printf("</body>\n");
printf("</html>\n");
return 0;
}
?跺??灏辨??缂?璇?myled.c锛?
arm-none-linux-gnueabi-gcc -o myled.cgi myled.c -static
锛?????????myled.cgi??浠舵?瘋??闆????跨??www/cgi-bin涓????跺??淇??逛?myled.cgi??浠剁??????锛?
chmod 777 myled.cgi
??淇??瑰??灏卞??浠ラ????寮????匡?ps??涓?涓?boa?????琛?锛??跺??灏辯?ㄦ?瑙??ㄦ??寮?浣?寮????跨??IP?闆??锛???浠ョ???頒??劇??????锛????╀?涓?LED椤規?璇??э?瀹?楠?灏辨????浜???涔???浠ョ?ㄤ??????鴻??涓?涓?锛????拌?涓?涓?????????绁?濂?(??杈矽???涓??ヨ??锛???瀹???锛?
??缁???璇昏?杩?绡???绔???浜猴?涓轟漢澶?涓?锛?瑕???榛??崇?斤??闆害?稿?锛?涓?瀹?瑕????″ソ??瀵革?瑕?杩?????搴????瀹?????锛????浜ゆ?瑷?娣憋?涔?涓?璁寵??濡?娣憋??ヤ?????涓?涓???锛?澶?姹?婀???杩?姹?婀?
涓??㈣??ヨ???㈡?㈡?ュ??锛?涓?绡???绔?瑙???