lighttpd是一種適合在生產(chǎn)環(huán)境中運(yùn)行的高性能web服務(wù)器。它是高度優(yōu)化,安全且非常靈活的web服務(wù)器;與其他web服務(wù)器相比,lighttpd使用的內(nèi)存和cpu非常低。其事件驅(qū)動(dòng)架構(gòu)針對(duì)大量并行連接進(jìn)行了優(yōu)化(保持活躍狀態(tài))
Lighttpd為一些流行的Web 2.0站點(diǎn)提供了支持。它提供了高速I(mǎi)O基礎(chǔ)設(shè)施,使它們能夠在相同的硬件上擴(kuò)展好幾倍。這是在考慮未來(lái)網(wǎng)絡(luò)的情況下開(kāi)發(fā)的,如:更快的FastCGI、COMET符合mod_mailbox、異步IO。
可以按照以下步驟在基于RHEL的系統(tǒng)上安裝Lighttpd。
步驟1:添加EPEL存儲(chǔ)庫(kù)
EPEL yum存儲(chǔ)庫(kù)擁有最新的Lighttpd包,首先在你的系統(tǒng)中添加EPEL yum存儲(chǔ)庫(kù)。
#?rpm?-Uvh?http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
步驟2:安裝LightTPD服務(wù)器
使用yum包管理器安裝lighttpd
#?yum?install?lighttpd?lighttpd-fastcgi
Loaded?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服務(wù)器
在啟動(dòng)lighttpd配置之前,請(qǐng)確保系統(tǒng)中禁用了selinux。
#?getenforece
現(xiàn)在編輯Lighttpd配置文件/etc/lighttpd/lighttpd.conf
server.use-ipv6?=?"disable" server.max-fds?=?2048
server.use-ipv6:將此值設(shè)置為“diable”將允許服務(wù)器監(jiān)聽(tīng)I(yíng)Pv6連接并禁用IPv6連接。
server.max-fds?Lighttpd是單線程服務(wù)器,其主要資源限制是文件描述符的數(shù)量,默認(rèn)情況下設(shè)置為1024(在大多數(shù)系統(tǒng)上)。要處理高流量站點(diǎn),可以將此設(shè)置為2048。
步驟4:?jiǎn)?dòng)LightTPD服務(wù)器
最后使用以下命令啟動(dòng)lighttpd服務(wù)
#?service?lighttpd?start
要停止或重新啟動(dòng)服務(wù)器,請(qǐng)使用以下命令。
#?service?lighttpd?stop #?service?lighttpd?restart
使lighttpd在服務(wù)器啟動(dòng)時(shí)啟動(dòng)
#?chkconfig?lighttpd?on
【相關(guān)推薦:Linux視頻教程】