Lighttpd安装配置
- 概述 1.1. Lighttpd概述 Lighttpd 是由德国人 Jan Kneschke 领导开发的,基于BSD许可的开源WEB服务器软件,其根本的目的是提供一个专门针对高性能网站,安全、快速、兼容性好并且灵活的web server环境。具有非常低的内存开销,CPU占用率低,效能好,以及丰富的模块等特点。Lighttpd 是众多OpenSource轻量级的web server中较为优秀的一个。支持FastCGI, CGI, Auth, 输出压缩(output compress), URL重写, Alias等重要功能。因此对于那些负载非常高的WEB服务器选用 Lighttpd 会是非常完美的解决方案。 (摘自http://www.lighttpd.com.cn 中文Wiki) 1.2. 高级特性 虚拟主机 virtual directory listings URL-Rewriting, HTTP-Redirects automatic expiration of files 大文件支持 (64bit fileoffsets) 断点续传(start-end, start-, -end, multiple ranges) 压缩输出 (支持deflate, gzip, bzip2) 认证方法 basic, digest backends: plain files, htpasswd, htdigest, ldap fast and secure application controlled downloads Server Side Includes User Tracking FastCGI, CGI, SSI SSL 1.3. PHP支持 same speed as or faster than apache + mod_php4 includes a utility to spawn FastCGI processes (neccesary for PHP 4.3.x) 通过 FastCGI 和 CGI 接口实现 支持PHP代码缓存,例如XCache, APC 或 eAccelarator FastCGI负载均衡(one webserver distibutes request to multiple PHP-servers via FastCGI) 1.4. 安全特性 chroot(), set UID, set GID protecting docroot strict HTTP-header parsing
1.5. 选用Lighttpd的理由 高连接并发能力: 在作为文件服务器时,每秒可处理请求数超过2000 非常稳定,可做到7*24不间断运行 可承受每天100 Mio 当运营压力增大时,可非常方便加入新的业务节点 深受业界欢迎:
1.6. 可替换Lighttpd的方案 Lighttpd只是一个简单的HTTP服务器,用Tomcat、Apache、JBoss等等均可以代替它,但作为WEB发布静态文件用,lighttpd从性能来说更理想。 1.7. Lighttpd部署方案
- 运行环境要求 2.1. 操作系统 SUSE 10 Enterprise Server 2.2. Lighttpd版本 Lighttpd-1.4.18
可到该处下载http://www.lighttpd.com.cn 2.3. PCRE版本 pcre-devel-5.0
- 安装
- 先安装pcre 把pcre-devel-5.0-3.i586.rpm上传到/usr下,执行 rpm –ivh pcre-devel-5.0-3.i586.rpm
- 把Lighttpd-1.4.18.tar.gz上传到suse的 /usr 目录下下
- 打开一个shell,通过cd命令进入/usr
- 执行命令:tar –zxvf lighttpd-1.4.18.tar.gz 该命令将把东西解压到/usr/ lighttpd-1.4.18下
- 通过cd命令进入/usr/lighttpd-1.4.18
- 执行命令: ./configure --prefix=/usr/local/lighttpd-1.4.18 --enable-fastcgi --enable-discard-path --enable-force-redirect
- 执行命令:make
- 执行命令:make install
- 解压Lighttpd.rar得到一个etc目录,把它拷贝到suse上进行/etc目录覆盖( )
- 执行命令: chmod +x /etc/init.d/lighttpd 通过以上步骤即可把Lighttpd安装成功。
- 配置 Lighttpd的配置文件位于: /etc/lighttpd/lighttpd.conf
配置例子。
需要更改的配置项如下: #发布的目录,它将会发布该文件架/down下的所有文件和子目录,在http的访问路径上,#不包括down server.document-root=”/down”
#HTTP端口 server.port=80 5. Nginx启动和关闭
- 启动 /etc/init.d/lighttpd start
- 关闭 /etc/init.d/lighttpd stop
- 重启 /etc/init.d/lighttpd restart