- 浏览: 29653 次
- 性别:
- 来自: 北京
最新评论
1. 安装编译环境
从 LINUX5.5 光盘中 server 目录下找到如下 rpm 包:
升级安装
rpm -Uvh --force --nodeps *rpm
2. 下载 lighttpd
从 http://lighttpd.net/download/下载最新的源码 lighttpd-1.4.28.tar.gz
$ gzip -cd lighttpd-1.4.28.tar.gz | tar xf
$ cd lighttpd-1.4.28
$./configure --host=i386-linux --prefix=/usr/local/lighttpd-1.4.28-linux
////////////--build=arm-linux --target=arm-linux
$make
$make install
复制lighttpd.conf
、modules.conf
到指定目录
$ mkdir /usr/local/lighttpd/etc
$ cp doc/config/lighttpd.conf usr/local/lighttpd-1.4.28-linux/etc/
$ cp doc/config/ modules .conf /usr/local/lighttpd-1.4.28-linux/etc
# 权限配置
groupadd lighttpd
useradd
lighttpd lighttpd
mkdir /www
chown -R lighttpd.lighttpd /www
mkdir /home/lighttpd/logs
chown -R lighttpd.lighttpd /home/lighttpd/logs
chmod 750 /lighttpd/logs
#
安装文件下的启动脚本
cp doc/initscripts/rc.lighttpd /etc/init.d/lighttpd
chkconfig lighttpd on
修改
/etc/init.d/lighttpd
,将配置文件变量更改为:
vi /etc/init.d/lighttpd
# LIGHTTPD_CONFIG=/etc/sysconfig/lighttpd
LIGHTTPD_CONFIG=/usr/local/lighttpd-1.4.28-linux/etc/lighttpd.conf
LIGHTTPD_BIN =/usr/local/lighttpd-1.4.28-linux/sbin/lighttpd
LIGHTTPD_CONF_PATH=/usr/local/lighttpd-1.4.28-linux/etc/lighttpd.conf
3. 配置
$vi /usr/local/lighttpd-1.4.28-linux/etc/ lighttpd.conf
1) 将 server.port = 80 改成 server.port = 8899 ,后面的端口只要不重复就可以了;
2) 将 server.use-ipv6 = “enable” 此行注释掉 # server.use-ipv6 = “enable”
3) 建立相关目录
var.log_root = "/home/lighttpd/logs "
var.server_root = "/www"
var.state_dir = "/home/lighttpd/run"
var.home_dir = "/home/lighttpd/lib/lighttpd"
var.conf_dir = "/home/lighttpd/lighttpd"
4. 启动 lighttpd
$ cd /usr/local/lighttpd-1.4.28-linux
$ ./sbin/lighttpd -f ./etc/lighttpd.conf
5. 测试
编辑 index.html 文件
vi /www /htdocs/index.html
hello world
在浏览器地址输入 http://ip:8899/index.html
显示出页面信息
6. 其它
一,为什么要使用
lighttpd?
apache
不可以吗?
在支持纯静态的对象时,比如图片,文件等
,
lighttpd
速度更快,更理想
至于它和
apache
的比较,很多文档,大家可以
google
一下
二,从何处下载
lighttpd?
http://www.lighttpd.net/download/
这个是它的官方站
三,如何安装?
1,
编译安装
./configure --prefix=/usr/local/lighttpd
make
make install
configure
完毕以后,会给出一个激活的模块和没有激活模块的清单,可以检查一下,是否自己需要的模块都已经激活,在
enable
的模块中一定要有
“mod_rewrite”
这一项,否则重新检查
pcre
是否安装。
2,
编译后配置
cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd
mkdir /etc/lighttpd
cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
如果你的
Linux
是
RedHat/CentOS
,那么:
cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd
如果你的
Linux
是
SuSE
,那么:
cp doc/rc.lighttpd /etc/init.d/lighttpd
其他
Linux
发行版本可以自行参考该文件内容进行修改。
然后修改
/etc/init.d/lighttpd
,把
LIGHTTPD_BIN=/usr/sbin/lighttpd
改为
LIGHTTPD_BIN=/usr/local/lighttpd/sbin/lighttpd
此脚本用来控制
lighttpd
的启动关闭和重起:
/etc/init.d/lighttpd start
/etc/init.d/lighttpd stop
/etc/init.d/lighttpd restart
3,
配置
修改
/etc/lighttpd/lighttpd.conf
1
)
server.modules
取消需要用到模块的注释,
mod_rewrite
,
mod_access
,
mod_fastcgi
,
mod_simple_vhost
,
mod_cgi
,
mod_compress
,
mod_accesslog
是一般需要用到的。
我们放开
"mod_rewrite"
"mod_compress",
2
)
server.document-root,
server.error-log
,
accesslog.filename
需要指定相应的目录
server.document-root = "/www/phc/html/"
mkdir /usr/local/lighttpd/logs
chmod 777 /usr/local/lighttpd/logs/
touch /usr/local/lighttpd/logs/error.log
chmod 777 /usr/local/lighttpd/logs/error.log
server.errorlog = "/usr/local/lighttpd/logs/error.log"
accesslog.filename = "|/usr/sbin/cronolog
/usr/local/lighttpd/logs/%Y/%m/%d/accesslog.log"
3
)用什么权限来运行
lighttpd
server.username = "nobody"
server.groupname = "nobody"
从安全角度来说,不建议用
root
权限运行
web server
,可以自行指定普通用户权限。
4
)静态文件压缩
mkdir /usr/local/lighttpd/compress
chmod 777 /usr/local/lighttpd/compress/
compress.cache-dir = "/usr/local/lighttpd/compress/"
compress.filetype = ("text/plain",
"text/html","text/javascript","text/css")
可以指定某些静态资源类型使用压缩方式传输,节省带宽,
对于大量
AJAX
应用来说,可以极大提高页面加载速度。
5
)
server.port =
81
6
)
#$HTTP["url"]
=~ "\.pdf$" {
131 # server.range-requests = "disable"
132 #}
4
,优化
1
最大连接数
默认是
1024
修改
server.max-fds,
大流量网站推荐
2048.
因为
lighttpd
基于线程
,
而
apache(MPM-prefork)
基于子进程
,
所以
apache
需要设置
startservers,maxclients
等
,
这里不需要
2 stat()
缓存
stat()
这样的系统调用
,
开销也是相当明显的
.
缓存能够节约时间和环境切换次数
(context switches)
一句话
,lighttpd.conf
加上
server.stat-cache-engine = “fam”
lighttpd
还另外提供
simple(
缓存
1
秒内的
stat()),disabled
选项
.
相信没人会选
disabled
吧
.
3
常连接
(HTTP
Keep-Alive)
一般来说
,
一个系统能够打开的文件个数是有限制的
(
文件描述符限制
)
常连接占用文件描述符
,
对非并发的访问没有什么意义
.
(
文件描述符的数量和许多原因有关
,
比如日志文件数量
,
并发数目等
)
这是
lighttpd
在
keep-alive
方面的默认值
.
server.max-keep-alive-requests = 128
server.max-keep-alive-idle = 30
换言之
,lighttpd
最多可以同时承受
30
秒长的常连接
,
每个连接最多请求
128
个文件
.
但这个默认值确实不适合非并发这种多数情况
.
lighttpd.conf
中减小
server.max-keep-alive-requests
server.max-keep-alive-idle
两个值
,
可以减缓这种现象
.
甚至可以关闭
lighttpd
keep-alive.
server.max-keep-alive-requests = 0
4
事件处理
对于
linux kernel
2.6
来说
,
没有别的可说
lighttpd.conf
中加上这一句足矣
server.event-handler = “linux-sysepoll”
另外
,
linux 2.4
使用
linux-rtsig
freebsd
使用
freebsd-kqueue
unix
使用
poll
5
网络处理
lighttpd
大量使用了
sendfile()
这样一个高效的系统调用
.
减少了从应用程序到网卡间的距离
.
(
同时也减少了
lighttpd
对
cpu
的占用
,
这部分占用转嫁到内核身上了
)
根据平台
,
可以设置不同的参数
.
server.network-backend = “linux-sendfile”
(linux)
freebsd: freebsd-sendfile
unix: writev
如果有兴趣的话
,
也可以看看
lighttpd
在
async io(aio)
上的实现
,
仅限
lighttpd 1.5
(linux-aio-sendfile, posix-aio, gthread-aio)
此外
,
网络方面
,
核心的参数也需要适当进行修改
,
这里就不需要详细说明了
.
5,
启动
6,
配置日志
logrotate & cronolog
logrotate
很粗暴
,
直接把进程砍了然后移动日志
cronolog
就是比较不错的方式
.
lighttpd
用法
:
accesslog.filename = " |/usr/sbin/cronolog
/var/log/lighttpd/%Y/%m/%d/access_XXXX.log"
7,
安装
pcre
从何处下载
?
http://www.pcre.org/
wget ftp://ftp.csx.cam.ac.uk/pub/soft ... re/pcre-7.4.tar.bz2
安装过程:
./configure
make clean
make
make install
8,
支持
fam
gamin
默认已安装了此包
yum install gamin-devel
另外配置时需添加:
./configure --prefix=/usr/local/lighttpd --with-fam
9,
测试
lighttpd
的启动:
/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf
发表评论
-
linux下查看磁盘空间
2012-07-18 09:38 866linux下查看磁盘空间 如果要查看磁盘还剩多少 ... -
linux主机之间远程复制文件或目录命令
2012-06-29 09:46 948linux主机之间远程复制文件或目录命令: 复制文件: ( ... -
linux cp命令
2012-06-29 09:15 848cp命令 该命令的功能是将给出的文件或目录拷贝到 ... -
Linux 和 windows修改java虚拟机内存大小
2012-06-15 15:36 757因为内存溢出问题1. Linux下 ... -
Apache + Tomcat + Linux 集群和均衡负载 (Session 同步复制) 配置实践指南
2010-11-05 15:20 992Apache + Tomcat + Linux 集群和均 ... -
RHEL5(X64)双机热备 ——安装数据库
2010-11-05 14:44 1267RHEL5 ( X64 )双机热备 ——安 ... -
更改主机名、RPM命令参数、VI技巧、解压与安装、Rpm包下载点
2010-11-05 14:40 1096更改主机名 第一步: #host ... -
NFS服务安装与配置
2010-11-05 14:37 10931. 验查NFS 是否安装 ... -
linux 下安装jdk6、tomcat6
2010-11-05 14:35 10921 、到 sun 网站下载 jdk rpm 软 ... -
通过rpm包安装、配置及卸载mysql的详细过程
2010-11-05 14:34 804用 su - 切换用户,可带环境信息 ... -
远程COPY/开启linux平台ftp/telnet服务
2010-11-05 14:32 1298远程 COPY scp root@10.5.0.1: ... -
Linux下rz,sz与ssh的配合使用
2010-11-05 14:30 1745Linux 下 rz , ... -
Linux下双机热备(基于heartbeat)
2010-11-05 14:26 1054Linux 下双机热备(基于 heartbeat ... -
ubunt 10.04 基本配置学习手册
2010-05-28 10:11 1602近来玩ubunt 10.04 时,遇到不少问题,从网查到了解决 ...
相关推荐
Lighttpd 是一款开源 Web 服务器软件。Lighttpd 安全快速,符合行业标准,适配性强并且针对高配置环境进行了优化。相对于其它的 Web 服务器而言,Lighttpd 占用内存更少;...安装Lighttpd 使用包管理器安装
在Linux上安装Lighttpd,里面有遇到的一些问题的解决方法,整个安装流程,还有参考网站
逛javaeye时,看到大牛们推荐使用lighttpd Web服务器,如是下载下来安装尝试了一把。
详细介绍了lighttpd 安装与配置。
安装lighttpdReleases of lighttpd are built regulary for at least the following platforms ● Linux(binary packages for FC3,SuSE,Debian,Gentoo,PLD-Linux,OpenWRT) ● *BSD(FreeBSD,NetBSD,OpenBSD,MacOSX)...
use linux下安装php5、Lighttpd 1.下载各种PHP5需要的相关安装包(如jpeg8、libpng、freetype、zlib、GD库、curl、libxml2==),编译,安装,注意与服务器版本相同。 a.64位服务器对软件的编译: CFLAGS="-O3 -...
在您的运行清单中包含recipe[lighttpd]以安装lighttpd。 要配置和启用虚拟主机,请通过在食谱中添加配方来使用lighttpd_vhost和lighttpd_site定义。 lighttpd_vhost定义将创建并配置虚拟主机配置, lighttpd_site将...
纯绿色,安装后无需再配置。支持系统服务和非服务两种启动方式,自由切换。一次性安装无需再安装,即使重做系统后亦可使用,直接点启动即可。小巧简易迷你只有14M,非常方便的搭建网站服务器。有专门开发的控制面板...
7. 本程序分为安装版和非安装版,无论是安装还是免安装,最后的效果完全一致。 8. 鉴于phpMyAdmin的导入导出功能太弱,并且大文件SQL还容量出错,故将phpMyAdmin换成SQL-Front。 系统服务和非服务启动的区别: 系统...
这是一个可在安卓手机上布置的服务器环境,功能组件包括:lighttpd、php和mysql,能成功运行DZ等php程序,安装和配置过程十分简单,也许现在该是讨论用什么手机做服务器更合适的时候了。 演示图片为一成功运行的...
NULL 博文链接:https://beike.iteye.com/blog/364813
可以安装在windows上的lighttpd,轻量级webserver ,占用自资源非常少,效率相当高。
首先安装 lighttpd 和 webpy,因为用 kpackagekit 做软件管理,在安装 webpy 的时候会自动安装 flup
Veket 官方论坛 lanwairen123 打包的 pet 直接双击安装即可,非原创,纯属分享。 在veket 上安装 php mysql 环境,随身的 php 服务器,php 5.2 + mysql 5.1。 veket 5.27 + veket 5.30测试通过,其他自测 直接...
OS: CentOS release 5.5 Lighttpd: 1.4.28 安装 sudo yum install lighttpd.i386 lighttpd-fastcgi.i386 lighttpd-mod_mysql_vhost.i386 运行 检查配置文件 lighttpd -t -f lighttpd.conf 启动lighttpd服务 ...
您可以在其中扮演决策者和受影响的公民一个城市模拟器,您可以在其中扮演经理和受决策影响的公民被各种hackaton项目废弃设计文件会议7 月 15 日: : 跑步下载并在同一文件夹中播放apt-get 安装 lighttpd lighttpd -...
centos7下安装测试成功的所有安装包整合