lighttpd web server
/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd-1.4.45
http://www.lighttpd.net/
http://www.lighttpd.net/2017/1/14/1.4.45/
https://redmine.lighttpd.net/projects/lighttpd/wiki
参考文档:
lighttpd交叉编译及使用
https://blog.csdn.net/djstavaV/article/details/88526586
https://xugaoxiang.com/2019/12/08/embedded-lighttpd/
lighttpd轻量级web嵌入式服务器,方便嵌入式平台移植,小巧安全(Lighttpd lightweight web embedded server, convenient for embedded platform transplantation, compact and safe)
软件简介
Lighttpd 是一个德国人领导的开源 Web 服务器软件,其根本的目的是提供一个专门针对高性能网站,安全、快速、兼容性好并且灵活的 Web Server 环境。具有非常低的内存开销,CPU 占用率低,效能好,以及丰富的模块等特点。
Lighttpd 是众多 OpenSource 轻量级的 Web Server 中较为优秀的一个。支持 FastCGI, CGI, Auth, 输出压缩(output compress), URL 重写, Alias 等重要功能,而 Apache 之所以流行,很大程度也是因为功能丰富,在 Lighttpd 上很多功能都有相应的实现了,这点对于 Apache 的用户是非常重要的,因为迁移到 Lighttpd 就必须面对这些问题。
ubuntu 16.04 需要安装的包
sudo apt-get install libglib2.0-dev
sudo apt-get install autoconf automake libtool
sudo apt-get install libbz2-dev
sudo apt-get install libcurl4-openssl-dev
编译 lighttpd-1.4.45
mkdir -p lighttpd
cd lighttpd
tar xvf ../lighttpd-1.4.45.tar.gz -C .
mkdir -p install
ls
install lighttpd-1.4.45
cd lighttpd-1.4.45/
./autogen.sh
./configure --prefix=/home/sama5d2/general_work/http_web_server/lighttpd/install
make
make install
配置
cd ../install/
pwd
/home/sama5d2/general_work/http_web_server/lighttpd/install
ls
lib sbin share
mkdir -p cache cgi-bin config log sockets vhosts webpages
cp -rf ../lighttpd-1.4.45/doc/config/conf.d/ ../lighttpd-1.4.45/doc/config/lighttpd.conf ../lighttpd-1.4.45/doc/config/modules.conf config/
修改配置文件
vi config/lighttpd.conf
var.log_root = "/home/sama5d2/general_work/http_web_server/lighttpd/install/log"
var.server_root = "/home/sama5d2/general_work/http_web_server/lighttpd/install"
var.state_dir = "/home/sama5d2/general_work/http_web_server/lighttpd/install"
var.home_dir = "/home/sama5d2/general_work/http_web_server/lighttpd/install"
var.conf_dir = "/home/sama5d2/general_work/http_web_server/lighttpd/install/config"
port
server.port = 8999
document-root
server.document-root = server_root + "/webpages"
创建 webpages/index.html
cd webpages/
vi index.html
内容为:
<html>
<head>
<title>lighttpd test</title>
</head>
<body>
<p>lighttpd for mips-linux</p>
</body>
</html>
创建 cgi-bin
cd ..
pwd
/home/sama5d2/general_work/http_web_server/lighttpd/install
mkdir -p webpages/cgi-bin
vi config/conf.d/cgi.conf
最后一步,修改config/modules.conf
vi config/modules.conf
准备一个用C语言编写的CGI程序
pwd
/home/sama5d2/general_work/http_web_server/lighttpd/install
vi hello.c
hello.c的内容
#include "stdio.h"
int main()
{
printf("Content-Type: text/plain\n\n");
printf("Hello CGI!\n");
return 0;
}
编译一下
gcc hello.c -o hello.cgi
cp hello.cgi webpages/cgi-bin/
将生成的hello.cgi放到上面创建好的cgi-bin文件夹下,然后重启下lighttpd
killall lighttpd
./sbin/lighttpd -f config/lighttpd.conf
一切就绪,在浏览器中访问下这个cgi
网页显示
http://192.168.99.31:8999/
lighttpd for mips-linux