lighttpd及相关依赖库pcre/bzip2在ubuntu下的安装
来源:互联网 发布:如何出售淘宝模版 编辑:程序博客网 时间:2024/06/01 07:27
lighttpd及相关依赖库pcre/bzip2在ubuntu下的安装
- lighttpd及相关依赖库pcrebzip2在ubuntu下的安装
- A环境说明
- B安装bzip2
- 下载解压
- 设置配置选项
- 编译安装
- C安装pcre
- 下载解压
- 设置配置选项
- 编译安装
- 将库文件导入cache
- 将路径导入环境变量
- 使用方法
- D安装lighttpd
- 下载解压
- 设置配置选项
- 编译安装
- 文件结构设置
- 服务器配置
- 1修改lighttpdconf
- 2修改modulesconf
- 3修改confdcgiconf
- 服务器的启动和关闭
- lighttpd及相关依赖库pcrebzip2在ubuntu下的安装
A.环境说明
ubuntu12.04
gcc
B.安装bzip2
1.下载/解压
- 从bzip2下载安装程序
bzip2下载地址 - 解压安装包
tar -zxvf bzip2-1.0.6.tar.gz
- 将当前目录是设置到安装文件所在目录下
cd bzip2-1.0.6
2.设置配置选项
make -f Makefile-libbz2_so
-f 标志是使bzip2 根据另一个Makefile来编译,就是Makefile-libbz2_so文件,创建一个动态的libbz.so库文件,然后把bzip2工具连接到这个库上
3.编译安装
make && make install
注:
如果要重新安装bzip2,要先执行:rm -vf /usr/bin/bz*
命令,不然make install
命令会失败
C.安装pcre
1.下载/解压
- 从pcre下载安装程序
pcre下载地址 - 解压安装包
tar -xjpf pcre-7.8.tar.bz2
- 将当前目录是设置到安装文件所在目录下
cd pcre-7.8
2.设置配置选项
./configure --prefix=/usr/local/pcre-7.8 --libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre --enable-utf8
configure有许多参数可配,具体参见./configure --help
及手册
3.编译安装
make && make install
提示:
可以在make编译完后可以执行make check进行测试
4.将库文件导入cache
- 方法1:在/etc/ld.so.conf/中加入:
/usr/local/lib/pcre
,然后运行ldconfig - 方法2:在/etc/ld.so.conf.d/下新生成一个文件(或在其中的文件中加入同样内容),文件内容为:
/usr/local/lib/pcre
,然后运行ldconfig
5.将路径导入环境变量
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$/usr/local/lib/pcre
export LD_LIBRARY_PATH
C_INCLUDE_PATH=/usr/include/libxml2:/usr/local/include/pcre
export C_INCLUDE_PATH
6.使用方法
使用pcre编写C或C++程序,然后编译。
- 对于C程序,编译命令为: gcc -I/usr/local/include/pcre -L/usr/local/lib/pcre -lpcre file.c
- 对于C++程序,编译命令为: gcc -I/usr/local/include/pcre -L/usr/local/lib/pcre -lpcrecpp file.cpp
D.安装lighttpd
1.下载/解压
- 从lighttpd下载安装程序
lighttpd下载地址 - 解压安装包
tar -zxvf lighttpd.tar.gz
- 将当前目录是设置到安装文件所在目录下
cd lighttpd
2.设置配置选项
./configure --prefix=[服务器路径]
注意:
如果没有安装bzip2/pcre或者没有将其安装位置配置在环境变量中,可能会出现如下错误 configure: error: pcre-config not found, install the pcre-devel package or build with --without-pcre
configure: error: bzip2-headers and/or libs where not found, install them or build with --without-bzip2
3.编译安装
make && make install
4.文件结构设置
- 在服务器的目录下批量创建如下文件夹
mkdir {cache,cgibin,config,log,sockets,upload,vhosts,webpages}
- 将安装文件所在目录下的配置文件复制到服务器目录下
cp [安装文件路径]/doc/config/lighttpd.conf [服务器路径]/config
cp [安装文件路径]/doc/config/modules.conf [服务器路径]/config
cp -r [安装文件路径]/doc/config/conf.d [服务器路径]/config
5.服务器配置
批量修改刚才复制过来的文件的权限 chmod 777 [服务器路径]/config -R
(1)修改lighttpd.conf
- 修改默认路径:
16 16var.log_root = "[服务器路径]/log"
17 var.server_root = "[服务器路径]"
18 var.state_dir = "[服务器路径]"
19 var.home_dir = "[服务器路径]"
20 var.conf_dir = "[服务器路径]/config"
61 var.cache_dir = server_root + "/cache"
115 server.document-root = server_root + "/webpages"
408 server.upload-dirs = ( "[服务器路径]/upload" )
- 服务器默认端口设置
88 server.port = 80
- 关闭ipv6
93 server.use-ipv6 = "disable"
- 关闭虚拟用户
将104和105行注释掉104 #server.username = "lighttpd"
105 #server.groupname = "lighttpd"
- 127行注释掉
127 #server.pid-file = state_dir + "/lighttpd.pid"
- 将152行、158行、191行注释掉
152 #include "conf.d/access_log.conf"
158 #include "conf.d/debug.conf"
191 #server.network-backend = "linux-sendfile"
- 根据系统资源设置207行和254行的数值
207 server.max-fds = 256
254 server.max-connections = 128
- 将314至316行注释掉,如下所示:
314 #$HTTP["url"] =~ "\.pdf$" {
315 #server.range-requests = "disable"
316 #}
(2)修改modules.conf
- 加载扩展模块
去掉需要的模块的注释42 server.modules = (
43 "mod_access",
44 "mod_alias",
45 #"mod_auth",
46 #"mod_evasive",
47 "mod_redirect",
48 "mod_rewrite",
48 "mod_flv_streaming", //播放flv的需求模块
50 #"mod_setenv",
51 #"mod_usertrack",
52 )
注:
flv模块需要如下设置54 flv-streaming.extensions = ( ".flv" )
- 使能扩展模块,加载头文件
139 include "conf.d/cgi.conf"
(3)修改conf.d/cgi.conf
- 修改格式的默认处理
15 cgi.assign = (".cgi" => "")
16 #cgi.assign = ( ".pl" => "/usr/bin/perl",
17 # ".cgi" => "/usr/bin/perl",
18 # ".rb" => "/usr/bin/ruby",
19 # ".erb" => "/usr/bin/eruby",
20 # ".py" => "/usr/bin/python" )
- 设置默认处理程序路径
28 alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )
5.服务器的启动和关闭
- 设置执行文件权限
chmod 777 [服务器路径]/sbin -R
- 启动服务器
[服务器路径]/sbin/lighttpd -f [服务器路径]/config/lighttpd.conf
- 访问服务器
在浏览器中输入ip:port,访问服务器主页
主页路径在/webpages - 关闭服务器
killall lighttpd
- lighttpd及相关依赖库pcre/bzip2在ubuntu下的安装
- ubuntu下安装nginx依赖库zlib,pcre,openssl
- 在Ubuntu下安装lighttpd
- 正则库相关及windows-VS-C++环境下pcre && pcre++的编译和使用
- ubuntu下安装nginx时依赖库zlib,pcre,openssl安装方法
- ubuntu下安装nginx时依赖库zlib,pcre,openssl安装方法
- ubuntu下安装nginx时依赖库zlib,pcre,openssl安装方法
- ubuntu下安装nginx时依赖库zlib,pcre,openssl安装方法
- lighttpd及pcre的交叉编译
- ubuntu安装nginx依赖库zlib,pcre,openssl
- ubuntu下安装lighttpd
- 安装pcre-8.39和Lighttpd 在进行make的时候出现的问题
- 安装pcre-8.39和Lighttpd 在进行make的时候出现的问题
- awstats在lighttpd下的安装配置
- ubuntu下安装nginx时PCRE库、zlib库、OpenSSL库的安装
- nginx(2):ubuntu下安装nginx依赖gcc,zlib,pcre,openssl
- ubuntu下lighttpd编译安装
- 在Ubuntu或者Debian中安装PCRE库
- 第一次开了个博客
- HTML/CSS方法和JavaScript方法实现下拉菜单
- 关于Web项目发布时跳转首页
- RabbitMQ问题汇总
- DeepLearning tutorial(7)深度学习框架Keras的使用-进阶
- lighttpd及相关依赖库pcre/bzip2在ubuntu下的安装
- JAVA 面试,你常常忘记它们
- python django 实现文件上传
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
- spark ml 随机森林源码笔记五
- ASCII码排序
- Block Coordinate Descent(块坐标下降)
- USB驱动--USB鼠标
- 富文本常用封装(NSAttributedString浅析)