lighttpd install

本文介绍如何安装和配置轻量级Web服务器Lighttpd,包括解压安装包、配置文件的修改及服务启动步骤。
、安装lighttpd

# tar vxzf lighttpd-1.4.18.tar.gz
# cd lighttpd-1.4.18

# ./configure --prefix=/usr/local/lighttpd
# make
# make install

# mkdir /usr/local/lighttpd/htdocs
# mkdir /usr/local/lighttpd/etc
# cp ./doc/lighttpd.conf /usr/local/lighttpd/etc/

3、配置lighttpd

然后修改配置文件 /usr/local/lighttpd/etc/lighttpd.conf

把"mod_fastcgi"前边的#去掉(在24行);

把"mod_cgi"前边的#去掉(在29行)

设置网站根目录 server.document-root = "/usr/local/lighttpd/htdocs/" (40行)

设置错误日志文件路径 server.errorlog = "/usr/local/lighttpd/lighttpd.error.log" (43行)

设置访问日志文件路径 accesslog.filename = "/usr/local/lighttpd/access.log" (116行)

启动服务器

# cd /usr/local/lighttpd/sbin/

# ./lighttpd -f ../etc/lighttpd.conf


如果出现错误请把配置文件中如下内容删除

$HTTP["url"] =~ ".pdf$" {

server.range-requests = "disable"

}

redhat AS4 install

安装过程

1. 下载最新版本: http://www.lighttpd.net/download/lighttpd-1.4.12.tar.gz

2. 解压、安装、配置

shell> tar zxvf lighttpd-1.4.12.tar.gz
shell> cd lighttpd-1.4.12
shell> ./configure --prefix=/usr/local/lighttpd
shell> ./make
shell> ./make install
shell> cp doc/rc.lighttpd.redhat /etc/rc.d/init.d/lighttpd
shell> cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd
shell> mkdir /etc/lighttpd
shell> cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
shell> chkconfig lighttpd on

接下来打开/etc/rc.d/init.d/lighttpd修改lighttpd的值如下

lighttpd="/usr/local/lighttpd/sbin/lighttpd"

打开/etc/lighttpd/lighttpd.conf修改服务的端口,以及文档根目录的路径后启动lighttpd服务

shell> service lighttpd start

更多关于lighttpd的配置请看lighttpd的文档
附注

在lighttpd中可以通过下面的配置来实现每天一个访问日志文件

accesslog.filename = "| /usr/local/lighttpd/bin/rotatelogs /usr/local/lighttpd/logs/access_%Y%m%d.log 86400"

其中rotatelogs直接从apache的bin目录拷贝过来即可。
static-web_1.0.bb的内容如下: UMMARY = "Static web server with custom content" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" inherit allarch systemd SRC_URI = "file://index.html \ file://logo.png" # List the files that need packing #FILES_${PN} += "${datadir}/www/ ${sysconfdir}/lighttpd/ ${sysconfdir}/systemd/system/lighttpd.service" FILES_${PN} += "/usr/share/www/ /etc/lighttpd/ /etc/systemd/system/lighttpd.service" do_install() { # Explicitly create the www directory and ensure it is marked install -d -m 0755 ${D}${datadir}/www # Install web files #install -m 0644 ${WORKDIR}/index.html ${D}/usr/share/www/ #install -m 0644 ${WORKDIR}/logo.png ${D}/usr/share/www/ install -m 0644 ${WORKDIR}/index.html ${D}${datadir}/www/ install -m 0644 ${WORKDIR}/logo.png ${D}${datadir}/www/ # Install lighttpd install -d ${D}${sysconfdir}/lighttpd echo 'server.document-root = "/usr/share/www"' > ${D}${sysconfdir}/lighttpd/lighttpd.conf echo 'server.port = 80' >> ${D}${sysconfdir}/lighttpd/lighttpd.conf # Install the startup script #install -d ${D}${sysconfdir}/default #echo 'START=yes' > ${D}${sysconfdir}/default/lighttpd # Install systemd install -d ${D}/etc/systemd/system cat <<EOF > ${D}/etc/systemd/system/lighttpd.service [Unit] Description=Lighttpd Web Server After=network.target [Service] Type=simple ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf Restart=always User=root [Install] WantedBy=multi-user.target EOF } # Enable on boot pkg_postinst_${PN} () { if [ -x /usr/bin/systemctl ]; then systemctl enable lighttpd fi } RDEPENDS_${PN} += "lighttpd" 请问为什么会报错呢?
09-15
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值