CentOS 使用yum安装 Lighttpd web 服务器

CentOS osetc 375℃ 0评论

Lighttpd是一个快速且安全的并被优化的高性能web服务器。这种web服务器需要更低的内存以及很低的cpu使用率。包括下面的一下高级功能:

1
2
3
4
5
FastCGI
CGI
Auth
输出压缩
URL 重写

lighttpd
lighttpd 服务器软件包并不在默认的CentOS yum库里,所以你需要配置Epel repo库来安装。下面先来安装epel repo.

下载epel 软件包,使用wget 命令:

1
wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm

命令输出:

1
2
3
4
5
6
7
8
9
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]

使用rpm 命令安装刚才下载的epel软件包:

1
rpm -ivh epel-release-6-8.noarch.rpm

命令输出:

1
2
3
arning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
  1:epel-release           ########################################### [100%]

CentOS 安装Lighttpd

步骤一:使用yum命令安装下面的包:

1
yum install lighttpd lighttpd-fastcgi lighttpd-mod_geoip

命令输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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) <epel@fedoraproject.org>
 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!

启动lighttpd服务,并将其加入到系统自启动项里:

1
2
service lighttpd start
chkconfig lighttpd on

步骤二:CentOS lightpd web 服务器配置
1.编辑配置文件“/etc/lighttpd/lighttpd.conf”,更改下面的内容:

1
2
3
4
var.server_root = "/var/www"
include "modules.conf"
server.port = 80
server.document-root = server_root + "/lighttpd"

2. 编辑lighttpd模块文件”/etc/lighttpd/modules.conf”,取消注释下面的内容:

1
2
3
4
5
6
7
8
9
10
include "conf.d/fastcgi.conf"
server.modules = (
  "mod_access",
  "mod_alias",
  "mod_auth",
#  "mod_evasive",
 "mod_redirect",
  "mod_rewrite",
#  "mod_setenv",
#  "mod_usertrack",

)

步骤三: 重新启动lighttpd 服务
输入下面的命令重启lighttpd服务:

1
service lighttpd restart

转载请注明:osetc.com » CentOS 使用yum安装 Lighttpd web 服务器

喜欢 (0)or分享 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址