欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 维修 > 嵌入式web开发:boa、lighttpd

嵌入式web开发:boa、lighttpd

2025/6/20 2:52:36 来源:https://blog.csdn.net/weixin_39486335/article/details/143436994  浏览:    关键词:嵌入式web开发:boa、lighttpd

 嵌入式web开发:boa、lighttpd

https://blog.csdn.net/m0_37105371/category_10937068.html

BOA服务器的移植-CSDN博客

【第1部分:boa服务器部署到ubuntu里】

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

tar xvzf boa-0.94.13.tar.gz 

cd boa-0.94.13/src/

apt-get install bison flex

 sudo  rm -rf /var/lib/dpkg/lock

vim compat.h 120行 修改成 #define TIMEZONE_OFFSET(foo) foo->tm_gmtoff

vim boa.c 225行 注释这行:DIE("icky Linux kernel bug!");

./configure

make

ls -lh boa

mkdir /etc/boa

cp ../boa.conf /etc/boa/

vim /etc/boa/boa.conf

80 修改为 8080 

/var/www 修改为 /var/www/html

User nobody 修改为 User root

Group nogroup 修改为 Group 0

最后一行加 AddType application/x-httpd-cgi php

mkdir /var/log/boa

echo '' >  /var/log/boa/error_log

echo '' >  /var/log/boa/access_log

./boa

或 /home/fch/boa-0.94.13/src/boa

ps -ef | grep boa

http://ip:8080测试打开

【第2部分:移植boa到嵌入式linux】

安装交叉编译链

安装交叉编译链 - Powered by MinDoc

cd /home/fch

rz

tar -xvzf gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf.tar.gz

vi ~/.bashrc

export PATH=/home/fch/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin:$PATH

source ~/.bashrc

which arm-linux-gnueabihf-gcc

cd boa-0.94.13/src

修改Makefile

CC = arm-linux-gnueabihf-gcc 

CPP = arm-linux-gnueabihf-gcc -E

make clean

make

开发板执行:

mkdir /etc/boa

mkdir /var/log/boa

echo '' >  /var/log/boa/error_log

echo '' >  /var/log/boa/access_log

echo '' >   /var/log/boa/cgi_log

备份之前的

mv /etc/boa/boa.conf /etc/boa/boa.conf2

mv /usr/sbin/boa /usr/sbin/boa2

mv /etc/mime.types /etc/mime.types2

mv /usr/lib/boa/boa_indexer /usr/lib/boa/boa_indexer2

删除 rm /etc/boa/boa.conf  /usr/sbin/boa /etc/mime.types /usr/lib/boa/boa_indexer

虚拟机下载

sz /etc/boa/boa.conf

cd /etc/boa    rz

sz /home/fch/boa-0.94.13/src/boa

cd /usr/sbin   rz  chmod +x boa

sz /etc/mime.types

cd /etc   rz

sz /home/fch/boa-0.94.13/src/boa_indexer

cd /usr/lib/boa   rz  chmod +x boa_indexer

mkdir /usr/lib/cgi-bin/

启动

/usr/sbin/boa

如下更改还提示502错误,暂时无法解决

vi /var/www/html/acs/phpinfo.php

增加:#!/usr/bin/php-cgi

【第3部分:lighttpd】

# find / -name "*lighttpd*"

/etc/lighttpd

/etc/lighttpd/lighttpd.conf

/run/lighttpd.pid

/tmp/lighttpd-error.log

/usr/lib/lighttpd

/usr/sbin/lighttpd

/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

修改:配置文件:

vi /etc/lighttpd/lighttpd.conf

修改:模块文件:

vi /etc/lighttpd/modules.conf

1.在server.modules 中 去掉注释: "mod_rewrite",新增 "mod_cgi",

2.去掉注释: include "conf.d/cgi.conf" 

3.增加注释: server.username  = "www-data"  

4.增加注释: server.groupname = "www-data"

5.最后增加

url.rewrite-once = (

"^/static/(.*)" => "$0",

"^/([^.]+)$" => "/index.php"

)

修改cgi:

vi /etc/lighttpd/conf.d/cgi.conf 

cgi.assign = (".php" => "/usr/bin/php-cgi")

启动:

lighttpd -f /etc/lighttpd/lighttpd.conf -D

------------------------------------------------lighttpd-----------------------------------------------------

移植到其他板子

===在166(正式在用的一个板子)上执行===

cd  / 

tar -cvf lighttpd.tar.gz /etc/lighttpd/* /run/lighttpd.pid  /tmp/lighttpd* /usr/lib/lighttpd/* /usr/sbin/lighttpd

sz lighttpd.tar.gz

解压该文件,然后再压缩成zip文件 lighttpd.zip

===在其他板子上执行===

mv  /etc/init.d/S50nginx   /etc/init.d/nginxbak

cd /

rz

选择lighttpd.zip

unzip -o lighttpd.zip

chmod +x /usr/sbin/lighttpd

rm lighttpd.zip

----------------------------------烧录完的板子连接方法-----------------------------------------------

  1. 准备putty软件
  2. 输入连接参数(参考Win7下使用Putty代替超级终端通过COM串口连接开发板方法 - ☆星空物语☆ - 博客园

  1. 连接后确认ip信息和网口接入是否正确 (需要设置root密码 passwd root
  2. 板子ip修改 (以修改eth1 网口ip为10.10.2.111为例)

4.1记下来默认HWaddr参数

4.2编辑配置文件vi /etc/network/interfaces

加入配置参数

auto eth0

iface eth0 inet static

pre-up ifconfig eth0 hw ether 00:30:1B:BA:02:DB

address 192.168.1.77

netmask 255.255.255.0

auto eth1

iface eth1 inet static

pre-up ifconfig eth1 hw ether 00:30:1B:BA:02:DB

address 10.10.2.111

netmask 255.255.255.0

gateway 10.10.2.254

4.3保存信息 reboot ip生效

  1. ssh软件连接对应ip
  2. cd /etc/init.d

rz 上传 S99myrclocal (其他好用环境下/etc/init.d 中下载)

chmod 777 S99myrclocal

------------------------------------------------代码上传-----------------------------------------------------

  1. cd var/www
  2. mkdir html
  3. cd html
  4. mkdir acs
  5. rz 选择code.zip
  6. unzip -o code.zip
  7. 启动:lighttpd -f /etc/lighttpd/lighttpd.conf -D

进网页修改ip地址和终端地址为板子的真实ip,如下图:

reboot

/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf (如果以上弄完还不好使,执行这个命令启动lighttpd 或者删除板子上的 lighttpd 文件夹,新解压安装lighttpd.zip)

------------------------------------------------程序烧录----------------------------------------------------

烧录实际操作

教程地址

Purple Pi R1 烧录流程 · INDUSTIO

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词