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

相关推荐
E-iceblue1 天前
Excel 列转行/行列转换全指南:从 4 种常见解法到 Python 批量自动化
python·excel·python库·spire.xls
Data-Miner1 天前
AI处理数据的脚本复用与逻辑复用有什么区别?哪种方式更能沉淀工作成果
数据分析·excel
福兮说2 天前
在浏览器里写一个“够用就好“的 Excel 公式求值器
前端·javascript·excel·编译原理
慧都小妮子2 天前
标签打印如何减少手工抄数?用Bartender 直连 Excel 批量打印
excel·bartender·条码打印·标签打印软件·数据驱动打印·工业打印机
SunnyDays10113 天前
Java 设置 Excel 数据验证:整数、日期、文本长度、下拉列表和时间
java·excel·数据验证·下拉列表
Metaphor6923 天前
使用 Python 设置 Excel 行列自适应 【代码示例】
python·excel
用户0332126663673 天前
使用 Python 设置 Excel 行列自适应 【代码示例】
python·excel
企业数字化笔记3 天前
固定资产Excel批量导入怎么防重复?资产编码、重复检查和错误回执
java·后端·excel
CORNERSTONE3654 天前
低代码开发有哪些应用场景?
低代码·excel·erp·mes·企业数字化
小葱炖豆腐4 天前
python绘制excel折线图
python·excel·numpy·pandas·matplotlib