Lighttpd 服务器的安装

一.安装lighttpd所需的库文件

1
2
3
4
5
6
7
8
9
10
11
1.安装 pcre wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
 
tar -zxvf pcre-8.10.tar.gz cd pcre-8.10 ./configure make make install
 
2.安装zlib wget http://zlib.net/zlib-1.2.5.tar.gz
 
tar -zxvf zlib-1.2.5.tar.gz cd zlib-1.2.5 ./configure make make install
 
3.安装bzip2 wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
 
cd bzip2-1.0.5 make make install

 

二.安装lighttpd

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
81
82
83
84
85
1.下载lighttpd
 
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.gz
 
2.编译安装
 
tar -zxvf lighttpd-1.4.28.tar.gz cd lighttpd-1.4.28 groupadd lighttpd useradd –g lighttpd lighttpd ./configure --prefix=/usr/local/lighttpd
 
make make install注意事项 如果make时出现类似以下错误
 
/usr/local/lib/libbz2.a: could not read symbols: Bad value则需要重新安装bzip2,
 
修改bzip2的Makefile文件 vim Makefile
 
CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) 
 
#找到此行添加-fPIC,如下: CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) -fPIC然后重新编译bzip和lighttpd
 
3.更改配置文件
 
cp -r doc/config  /usr/local/lighttpd/ mkdir -p /var/log/lighttpd chown -R lighttpd.lighttpd /var/log/lighttpd mkdir –p /usr/www/htdocs chown –R lighttpd.lighttpd /usr/www/htdocs4.
 
配置文件内容: vim/usr/local/lighttpd/config/lighttpd.conf
 
var.log_root    = "/var/log/lighttpd"
 
var.server_root = "/usr/www"
 
var.state_dir   = "/var/run"
 
var.home_dir    = "/usr/local/lighttpd/sbin/lighttpd"
 
var.conf_dir    = "/usr/local/lighttpd/config" 
 
var.vhosts_dir  = server_root + "/vhosts"
 
var.cache_dir   = "/var/cache/lighttpd"
 
var.socket_dir  = home_dir + "/sockets" 
 
include "modules.conf"
 
server.port = 80 
 
server.username  = "lighttpd"
 
server.groupname = "lighttpd" 
 
server.document-root = server_root + "/htdocs"
 
server.pid-file = state_dir + "/lighttpd.pid"
 
server.errorlog             = log_root + "/error.log" 
 
include "conf.d/access_log.conf"
 
include "conf.d/debug.conf" 
 
server.event-handler = "linux-sysepoll"
 
server.network-backend = "linux-sendfile"
 
server.max-fds = 2048
 
server.stat-cache-engine = "simple"
 
server.max-connections = 1024 
 
index-file.names += (  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
 
url.access-deny  = ( "~", ".inc"
 
$HTTP["url"] =~ "\.pdf$" {  server.range-requests = "disable"
 
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
 
include "conf.d/mime.conf"
 
include "conf.d/dirlisting.conf"
 
server.follow-symlink = "enable"
 
server.upload-dirs = ( "/var/tmp" )
 
图片存放在/usr/www/htdocs下面,生成的图片是以/年/月/日的形式存放的

三.启动lighttpd

1
/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/config/lighttpd

posted on   荣锋亮  阅读(977)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)

导航

< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5
点击右上角即可分享
微信分享提示