boa伺服器的搭建

2021-08-10 12:41:07 字數 2821 閱讀 7476

www.boa.org
tar xvf boa-0.94

.13.tar

.gz

第二步:進入解壓後的資料夾/boa/src執行

./configure命令

生成makefile檔案   

/*版本為第一步所示的版本,版本不對過程中可能會出現錯誤:

configure: error: cannot guess build type; you must specify one
在命令的後面新增   --build=arm-linux  即可  */
第三步:修改檔案

修改/src/boa.c

注釋掉第226行的if語句

if (setuid(0) != -1)
修改/src/compat.h

#define timezone_offset(foo)foo##->tm_gmtoff
修改為
#definetimezone_offset(foo)(foo)->tm_gmtoff
第四步:在/src資料夾下進行make

經過編譯後,/src資料夾下會生成boa和boa_indexer兩個檔案
第五步:新建資料夾

在/etc資料夾下新建/boa資料夾,用來存放boa.conf檔案和日誌檔案、報錯檔案。

在根目錄下(與/etc同級)新建/web資料夾和/web/cgi-bin資料夾,web 資料夾用來存放html檔案,/web/cgi-bin資料夾用來存放cgi檔案

第六步:拷貝檔案

將第四步產生的兩個檔案 boa和boa_indexer拷貝到/bin資料夾下

將/etc/mime.type 檔案拷貝到/web資料夾下

將boa/boa.conf 檔案拷貝到/etc/boa資料夾下

第七步:配置/etc/boa/boa.conf檔案

port 80

user nobody

group nogroup

errorlog /var/log/boa/error_log

accesslog /var/log/boa/access_log

documentroot /var/www

userdir public_html

directoryindex index.html

directorymaker /usr/lib/boa/boa_indexer

keepalivemax 1000

keepalivetimeout 10

mimetypes /etc/mime.types

defaulttype text/plain

cgipath /bin:/usr/bin:/usr/local/bin

alias /doc /usr/doc

scriptalias /cgi-bin

/ /usr/lib/cgi-bin

/

改為

port 80

user 0

group

0errorlog /etc/boa/error_log

accesslog /etc/boa/access_log

documentroot /web

userdir public_html

directoryindex index.html

directorymaker /bin/boa_indexer

keepalivemax 1000

keepalivetimeout 10

mimetypes /web/mime.types

defaulttype text/plain

cgipath /bin:/usr/bin:/usr/local/bin

alias /doc /usr/doc

scriptalias /cgi-bin

/ /web/cgi-bin

/

第八步:啟動伺服器

直接 輸入
boa
命令即可
第九步:測試

在/web資料夾下新建乙個index.html檔案(也可在別處新建,然後複製過來)

href="/cgi-bin/test.cgi">to cgi pagea>

body>

html>

在/web/cgi-bin資料夾下新建test.c檔案(也可在別處新建,將編譯後生成的test.cgi檔案拷貝過來即可)
#include 

int main()

編譯測試檔案
gcc -o test.cgi test.c
第十步:執行

在同網段的電腦瀏覽器中輸入boa伺服器所在主機的ip即可,收個頁面會跳轉到index.html介面,裡面會有個鏈結,連線到cgi檔案。

BOA伺服器的搭建

本教程基於4412開發板 第一步 解壓原始碼 tar vxf boa 0.94.13.tar.gz 第二步 生成makefile編譯檔案 切換到src目錄 cd boa 0.94.13 src 執行.configure 這樣就可以生成 makefile檔案 第三步 修改makefile引數 修改編譯...

web伺服器之boa搭建開發例項

使用web頁面遠端控制led 1 cgi程式設計 cgi common gateway inte ce 是外部應用擴充套件,應用程式與www伺服器互動的乙個標準介面。按照cgi標準編寫的外部擴充套件應用程式可以處理客戶端瀏覽器輸入的資料,從而完成客戶端與伺服器的互動操作。而cgi規範就定義了web伺...

boa伺服器實現CGI功能

cgi 是web 伺服器執行時外部程式的規範,按cgi 編寫的程式可以擴充套件伺服器功能。cgi 應用程式能與瀏覽器進行互動,還可通過資料庫api 與資料庫伺服器等外部資料來源進行通訊,從資料庫伺服器中獲取資料。格式化為html文件後,傳送給瀏覽器,也可以將從瀏覽器獲得的資料放到資料庫中。幾乎所有伺...