嵌入式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

相关推荐
zhangjin122220 分钟前
kettle插件-excel插件,kettle读取excel动态表头,kettle根据列名读取excel
excel·kettle·kettle excel插件·kettle 动态excel
远洪16 小时前
excel 找出两列不同的数据
excel
pcplayer16 小时前
非常好用的 Excel 读写控件
excel·delphi·office
Navicat中国20 小时前
使用 Navicat 导入向导导入 Excel 数据时,系统提示导入成功,表中也能看到数据,但行数统计显示为 0,这是什么原因?
数据库·excel·导入
穿着内裤的外星人1 天前
触控精灵远程读写Excel步骤配置
excel
是孑然呀1 天前
【小记】excel vlookup一对多(第二篇)
excel
开开心心就好1 天前
专为视障人士设计的免费辅助工具
windows·计算机视觉·计算机外设·excel·散列表·推荐算法·csdn开发云
transformer_WSZ1 天前
excel两列数据绘制折线图
excel·折线图
蒋胜山1 天前
Excel 练习题(5)
经验分享·excel
Data-Miner2 天前
数以轻舟聚焦Excel-Agent场景:当AI做表工具学会说人话
人工智能·excel