介绍

简要介绍

Lighttpd 是开源Web服务器软件,其基本的目标是提供一个专门针对高性能网站,平安、疾速、兼容性好并且灵便的Web Server环境。具备非常低的内存开销、CPU占用率低、效力好以及丰盛的模块等特点。

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处理器
磁盘分区对磁盘分区无要求

操作系统要求

操作系统要求如下所示。

我的项目版本
openEuler20.03 sp1 aarch64
Kernel4.19

阐明:

如果是全新装置操作系统,装置形式倡议不要应用最小化装置,否则很多软件包须要手动装置,可抉择“Server with GUI”装置形式。

配置编译环境

  1. 装置依赖库

    yum -y install gcc gcc-c++ glib2-devel pcre-devel bzip2-devel zlib-devel gamin-devel

  2. 获取源码

    下载地址:https://download.lighttpd.net...

配置装置

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.conf

vi /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://{{ server_ip }}:80/index.html