CentOS 使用yum安装 Lighttpd web 服务器
December 14, 2014
Lighttpd是一个快速且安全的并被优化的高性能web服务器。这种web服务器需要更低的内存以及很低的cpu使用率。包括下面的一下高级功能:
[cc lang=”php”]
FastCGI
CGI
Auth
输出压缩
URL 重写
[/code]
lighttpd 服务器软件包并不在默认的CentOS yum库里,所以你需要配置Epel repo库来安装。下面先来安装epel repo.
下载epel 软件包,使用wget 命令:
[cc lang=”php”]
wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
[/code]
命令输出:
[cc lang=”php”]
Resolving epel.mirror.net.in… 120.88.47.14, 2401:4800:2121:c0:ff:ee:ee:2
Connecting to epel.mirror.net.in|120.88.47.14|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 14540 (14K) [application/x-redhat-package-manager]
Saving to: “epel-release-6-8.noarch.rpm”
100%[==========================================================================================>] 14,540 54.6K/s in 0.3s
2014-02-23 12:24:53 (54.6 KB/s) – “epel-release-6-8.noarch.rpm” saved [14540/14540]
[/code]
使用rpm 命令安装刚才下载的epel软件包:
[cc lang=”php”]
rpm -ivh epel-release-6-8.noarch.rpm
[/code]
命令输出:
[cc lang=”php”]
arning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing… ########################################### [100%]
1:epel-release ########################################### [100%]
[/code]
CentOS 安装Lighttpd
步骤一:使用yum命令安装下面的包:
[cc lang=”php”]
yum install lighttpd lighttpd-fastcgi lighttpd-mod_geoip
[/code]
命令输出:
[cc lang=”php”]
Loaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.thelinuxfix.com
* epel: mirror.steadfast.net
* extras: holmes.umflint.edu
* updates: bay.uchicago.edu
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package lighttpd.x86_64 0:1.4.34-1.el6 will be installed
—> Package lighttpd-fastcgi.x86_64 0:1.4.34-1.el6 will be installed
–> Processing Dependency: spawn-fcgi for package: lighttpd-fastcgi-1.4.34-1.el6.x86_64
—> Package lighttpd-mod_geoip.x86_64 0:1.4.34-1.el6 will be installed
–> Processing Dependency: libGeoIP.so.1()(64bit) for package: lighttpd-mod_geoip-1.4.34-1.el6.x86_64
–> Running transaction check
—> Package GeoIP.x86_64 0:1.4.8-1.el6 will be installed
—> Package spawn-fcgi.x86_64 0:1.6.3-1.el6 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
======================================================================
Package Arch Version Repository
Size
======================================================================
Installing:
lighttpd x86_64 1.4.34-1.el6 epel 294 k
lighttpd-fastcgi x86_64 1.4.34-1.el6 epel 44 k
lighttpd-mod_geoip x86_64 1.4.34-1.el6 epel 21 k
Installing for dependencies:
GeoIP x86_64 1.4.8-1.el6 epel 620 k
spawn-fcgi x86_64 1.6.3-1.el6 epel 16 k
Transaction Summary
======================================================================
Install 5 Package(s)
Total download size: 995 k
Installed size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): GeoIP-1.4.8-1.el6.x86_64.rpm | 620 kB 00:00
(2/5): lighttpd-1.4.34-1.el6.x86_64.rpm | 294 kB 00:00
(3/5): lighttpd-fastcgi-1.4.34-1.el6.x86_64.rp | 44 kB 00:00
(4/5): lighttpd-mod_geoip-1.4.34-1.el6.x86_64. | 21 kB 00:00
(5/5): spawn-fcgi-1.6.3-1.el6.x86_64.rpm | 16 kB 00:00
———————————————————————-
Total 1.7 MB/s | 995 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6)
Package: epel-release-6-8.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : lighttpd-1.4.34-1.el6.x86_64 1/5
Installing : GeoIP-1.4.8-1.el6.x86_64 2/5
Installing : spawn-fcgi-1.6.3-1.el6.x86_64 3/5
Installing : lighttpd-fastcgi-1.4.34-1.el6.x86_64 4/5
Installing : lighttpd-mod_geoip-1.4.34-1.el6.x86_64 5/5
Verifying : lighttpd-1.4.34-1.el6.x86_64 1/5
Verifying : lighttpd-mod_geoip-1.4.34-1.el6.x86_64 2/5
Verifying : spawn-fcgi-1.6.3-1.el6.x86_64 3/5
Verifying : GeoIP-1.4.8-1.el6.x86_64 4/5
Verifying : lighttpd-fastcgi-1.4.34-1.el6.x86_64 5/5
Installed:
lighttpd.x86_64 0:1.4.34-1.el6
lighttpd-fastcgi.x86_64 0:1.4.34-1.el6
lighttpd-mod_geoip.x86_64 0:1.4.34-1.el6
Dependency Installed:
GeoIP.x86_64 0:1.4.8-1.el6 spawn-fcgi.x86_64 0:1.6.3-1.el6
Complete!
[/code]
启动lighttpd服务,并将其加入到系统自启动项里:
[cc lang=”php”]
service lighttpd start
chkconfig lighttpd on
[/code]
步骤二:CentOS lightpd web 服务器配置
1.编辑配置文件“/etc/lighttpd/lighttpd.conf”,更改下面的内容:
[cc lang=”php”]
var.server_root = “/var/www”
include “modules.conf”
server.port = 80
server.document-root = server_root + “/lighttpd”
[/code]
2. 编辑lighttpd模块文件”/etc/lighttpd/modules.conf”,取消注释下面的内容:
[cc lang=”php”]
include “conf.d/fastcgi.conf”
server.modules = (
“mod_access”,
“mod_alias”,
“mod_auth”,
# “mod_evasive”,
“mod_redirect”,
“mod_rewrite”,
# “mod_setenv”,
# “mod_usertrack”,
[/code]
)
步骤三: 重新启动lighttpd 服务
输入下面的命令重启lighttpd服务:
[cc lang=”php”]
service lighttpd restart
[/code]
0 Comments