Lighttpd是一种适合在生产环境中运行的高性能Web服务器。它是高度优化,安全且非常灵活的Web服务器;与其他Web服务器相比,LightTPD使用的内存和CPU非常低。其事件驱动架构针对大量并行连接进行了优化(保持活跃状态)
Lighttpd为一些流行的Web 2.0站点提供了支持。它提供了高速IO基础设施,使它们能够在相同的硬件上扩展好几倍。这是在考虑未来网络的情况下开发的,如:更快的FastCGI、COMET符合mod_mailbox、异步IO。
可以按照以下步骤在基于RHEL的系统上安装Lighttpd。
步骤1:添加EPEL存储库
EPEL yum存储库拥有最新的Lighttpd包,首先在你的系统中添加EPEL yum存储库。# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
步骤2:安装LightTPD服务器
使用yum包管理器安装lighttpd# yum install lighttpd lighttpd-fastcgiLoaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* epel: mirrors.ispros.com.bd
* extras: mirror.nbrc.ac.in
* updates: mirror.nhanhoa.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lighttpd.i686 0:1.4.35-1.el6 will be installed
---> Package lighttpd-fastcgi.i686 0:1.4.35-1.el6 will be installed
--> Processing Dependency: spawn-fcgi for package: lighttpd-fastcgi-1.4.35-1.el6.i686
--> Running transaction check
---> Package spawn-fcgi.i686 0:1.6.3-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package Arch Version Repository Size
===================================================================================================
Installing:
lighttpd i686 1.4.35-1.el6 epel 300 k
lighttpd-fastcgi i686 1.4.35-1.el6 epel 45 k
Installing for dependencies:
spawn-fcgi i686 1.6.3-1.el6 epel 16 k
Transaction Summary
===================================================================================================
Install 3 Package(s)
Total download size: 361 k
Installed size: 818 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): lighttpd-1.4.35-1.el6.i686.rpm | 300 kB 00:00
(2/3): lighttpd-fastcgi-1.4.35-1.el6.i686.rpm | 45 kB 00:00
(3/3): spawn-fcgi-1.6.3-1.el6.i686.rpm | 16 kB 00:00
---------------------------------------------------------------------------------------------------
Total 206 kB/s | 361 kB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
google-chrome-stable-34.0.1847.116-1.i386 has missing requires of libnss3.so(NSS_3.14.3)
Installing : lighttpd-1.4.35-1.el6.i686 1/3
Installing : spawn-fcgi-1.6.3-1.el6.i686 2/3
Installing : lighttpd-fastcgi-1.4.35-1.el6.i686 3/3
Installed:
lighttpd.i686 0:1.4.35-1.el6 lighttpd-fastcgi.i686 0:1.4.35-1.el6
Dependency Installed:
spawn-fcgi.i686 0:1.6.3-1.el6
Complete!
步骤3:配置LightTPD服务器
在启动lighttpd配置之前,请确保系统中禁用了selinux。# getenforece
现在编辑Lighttpd配置文件/etc/lighttpd/lighttpd.confserver.use-ipv6 = "disable"
server.max-fds = 2048
server.use-ipv6:将此值设置为“diable”将允许服务器监听IPv6连接并禁用IPv6连接。
server.max-fds Lighttpd是单线程服务器,其主要资源限制是文件描述符的数量,默认情况下设置为1024(在大多数系统上)。要处理高流量站点,可以将此设置为2048。
步骤4:启动LightTPD服务器
最后使用以下命令启动lighttpd服务# service lighttpd start
要停止或重新启动服务器,请使用以下命令。# service lighttpd stop
# service lighttpd restart
使lighttpd在服务器启动时启动# chkconfig lighttpd on