Lighttpd是浩瀚OpenSource轻量级的Web Server中较为精良的一个。支持FastCGI,CGI,Auth,输出压缩(output compress),URL重写,Alias等主要功能;而Apache之以是盛行,很大程度也是由于功能丰富,在Lighttpd上很多功能都有相应的实现了,这点对付Apache的用户是非常主要的,由于迁移到Lighttpd就必须面对这些问题。
开拓措辞:C
一句话描述:Web 做事器

建议利用版本为“Lighttpd 1.4.53”。
环境哀求硬件哀求硬件哀求如下所示。
项目
解释
做事器
TaiShan 200做事器(型号2280)
CPU
鲲鹏920 5250处理器
磁盘分区
对磁盘分区无哀求
操作系统哀求操作系统哀求如下所示。
项目
版本
openEuler
20.03 sp1 aarch64
Kernel
4.19
解释:
如果是全新安装操作系统,安装办法建议不要利用最小化安装,否则很多软件包须要手动安装,可选择“Server with GUI”安装办法。
配置编译环境安装依赖库
yum -y install gcc gcc-c++ glib2-devel pcre-devel bzip2-devel zlib-devel gamin-devel
获取源码下载地址:https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.53.tar.gz
配置安装cp lighttpd-1.4.53.tar.gz $HOME && cd $HOMEtar xzvf lighttpd-1.4.53.tar.gz
编译安装
cd lighttpd-1.4.53./configure --prefix=/usr/local/lighttpd --with-fammake -j60 && make install
解释:
--prefix=PATH:指定Lighttpd的安装目录。 --with-fam:fam 用于减少stat()函数调用次数。
参数配置创建软件目录cd /usr/local/lighttpd/mkdir log webpages cache config
拷贝配置文件/目录
cp $HOME/lighttpd-1.4.53/doc/config/lighttpd.conf /usr/local/lighttpd/config/cp $HOME/lighttpd-1.4.53/doc/config/modules.conf /usr/local/lighttpd/config/cp $HOME/lighttpd-1.4.53/doc/config/conf.d /usr/local/lighttpd/config/ -r
解释:
Lighttpd安装后的安装路径下只有三个文件夹 lib,sbin和share,其他文件须要自己拷贝和创建。
修正lighttpd.confvi /usr/local/lighttpd/config/lighttpd.conf
修正第16-20行为:
var.log_root = "/usr/local/lighttpd/log"var.server_root = "/usr/local/lighttpd"var.state_dir = "/usr/local/lighttpd"var.home_dir = "/usr/local/lighttpd"var.conf_dir = "/usr/local/lighttpd/config"
修正第61行为:
var.cache_dir = "/usr/local/lighttpd/cache"
第93行加注释:
#server.use-ipv6 = "enable"
修正第104-105行(该项为操作权限,不建议利用root)为:
server.username = "lighttpd1"server.groupname = "lighttpd"
修正第115行(访问页面存放路径)为:
server.document-root = server_root + "webpages"
修正第246行(缓存模式,默认为simple,官方阐明fam要优于simple)为:
server.stat-cache-engine = "fam"
在第182行添加如下内容(该项为配置多进程模式,Lighttpd默认单进程,数值可根据实际需求修正) :
server.max-worker = 4
创建用户组
groupadd lighttpduseradd -g lighttpd lighttpd1
修正权限
chown lighttpd1 /usr/local/lighttpd/log
添加测试页面
cd /usr/local/lighttpd/webpages vi index.html
<html><head><title>lighttpd test</title></head><body><p>this is a testing</p></body></html>
做事测试
启动lighttpd:
/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/config/lighttpd.conf
查见地式进程:
ps -ef |grep lighttpd
停滞apache:
pkill lighttpd
测试网页:
http://:80/index.html