Lighttpd 1.4.53 移植指南(openEuler 20.03 LTS SP1)

Lighttpd 1.4.53 移植指南(openEuler 20.03 LTS SP1) 来自远方 2023-11-29 11:30:08 470

介绍

简要介绍

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”。

环境要求

操作系统要求

操作系统要求如下所示。

说明:

如果是全新安装操作系统,安装方式建议不要使用最小化安装,否则很多软件包需要手动安装,可选择“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 $HOME
tar xzvf lighttpd-1.4.53.tar.gz
编译安装
cd lighttpd-1.4.53
./configure  --prefix=/usr/local/lighttpd  --with-fam
make -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  lighttpd
useradd -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

文章来源:www.openeuler.org/zh/blog/randy1568/Lighttpd%201-4-53-porting-guide.html

声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 点赞 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
来自远方
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区