- 论坛徽章:
- 0
|
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
Normal
0
7.8 磅
0
2
false
false
false
MicrosoftInternetExplorer4
st1\:*{behavior:url(#ieooui) }
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
Lighttpd轻量级web服务器安装手册
作者: 沈小然
版本:
文档编号:
日期:2008年3月17日
目 录
TOC \o "1-3" \h \z \u 1 下载软件包... PAGEREF _Toc193543073 \h 3
08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100390033003500340033003000370033000000
2 安装... PAGEREF _Toc193543074 \h 3
08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100390033003500340033003000370034000000
2.1 安装pcre包... PAGEREF _Toc193543075 \h 3
08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100390033003500340033003000370035000000
2.2 安装lighttpd服务器... PAGEREF _Toc193543076 \h 3
08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100390033003500340033003000370036000000
2.2.1 拷贝lighttpd配置文件和启动脚本... PAGEREF _Toc193543077 \h 4
08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100390033003500340033003000370037000000
2.2.2 基本的lighttpd配置文件... PAGEREF
_Toc193543078 \h 5
08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100390033003500340033003000370038000000
1
下载软件包
http://www.lighttpd.net/download
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
说明:lighttpd安装前必须要安装pcre包,pcre是一个包含了perl正则表达式的库。
2
安装
(以下源码包的实际包名以具体下载版本名为准)
2.1 安装pcre包
# tar zxf pcre-7.6.tar.gz
# cd pcre-7.6
# ./configure
# make;make install
2.2 安装lighttpd服务器
# tar zxf lighttpd-1.4.19.tar.gz
# cd lighttpd-1.4.19
# ./configure
执行成功后会打印出开启的和关闭的plug插件和feature信息
file:///C:/DOCUME%7E1/victor/LOCALS%7E1/Temp/msohtml1/01/clip_image003.jpg
# make;make install
你的lighttpd已经成功安装到了/opt/lighttpd目录下了。
2.2.1
拷贝lighttpd配置文件和启动脚本
1)拷贝配置文件到安装目录下。
# mkdir -p /etc/lighttpd
# cp doc/lighttpd.conf /etc/lighttpd/
2)拷贝启动脚本到linux启动目录下。
# cp doc/sysconfig.lighttpd /etc/sysconfig/
# cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd
因为安装路径与拷贝的启动脚本中相应路径不同,必须修改启动脚本,如下:
# vi /etc/init.d/lighttpd
lighttpd="/usr/sbin/lighttpd"
改为
lighttpd="/usr/local/sbin/lighttpd"
此脚本用来控制lighttpd的启动关闭和重起:
/etc/init.d/lighttpd start
/etc/init.d/lighttpd stop
/etc/init.d/lighttpd restart
# ps -ef|grep lighttpd 查看进程
nobody 27527 1 0 17:23 ?
00:00:00 /usr/local/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
3)创建错误日志目录,并赋予nobody:nobody属主。否则下面的服务启动不了。
# mkdir -p /var/log/lighttpd
# chown -R nobody.nobody
/var/log/lighttpd/
2.2.2
基本的lighttpd配置文件
官方配置各个选项参考:
http://trac.lighttpd.net/trac/wiki/Docs%3AConfigurationOptions#LighttpdCoreOptions
# lighttpd -f /etc/lighttpd/lighttpd.conf –p 直接打印配置文件的配置,不含注释信息。
# lighttpd -f /etc/lighttpd/lighttpd.conf –t 检查配置文件的语法
Syntax OK
# vi /etc/lighttpd/lighttpd.conf
# default
document-root 配置页面主目录
server.document-root = "/var/www/html/"
# TCP port
server.port = 80
# selecting modules 这两个模块必须打开。
server.modules = ( "mod_access",
"mod_rewrite" )
## where to send
error-messages to 错误日志路径
server.errorlog =
"/var/log/lighttpd/error.log"
#### accesslog
module 访问日志路径
accesslog.filename =
"/var/log/lighttpd/access.log"
## to help the
rc.scripts pid的生成位置
server.pid-file = "/var/run/lighttpd.pid"
## change uid to
(default: don't care) 默认执行用户名
server.username = "nobody"
## change uid to
(default: don't care) 默认执行组名
server.groupname = "nobody"
2.2.2.1
配置CGI路径
n
首先必须启动 "mod_rewrite","mod_redirect","mod_alias",
n
然后在static-file.exclude-extensions中指定cgi文件的扩展名
n
最后通过cgi.assign配置指令进行关联。
##
# which
extensions should not be handle via static-file transfer
# 允许执行的扩展名
# .php, .pl,
.fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions
= ( ".php", ".pl", ".fcgi", ".cgi")
#### CGI module
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( "" => "", ".cgi" =>
"" ) }
alias.url = ( "/cgi-bin/" =>
"/var/www/cgi-bin/" )
说明:
需要特定解析程序执行的CGI,可以指定解析程序的路径,比如:
cgi.assign = ( ".pl" =>
"/usr/bin/perl",
".cgi" =>
"/usr/bin/perl" )
对于带扩展名或不带扩展名都不需要特定解析程序就能执行的CGI,可指定解析程序为空,比如:
cgi.assign = ( "" => "",
".cgi" => "" )
保存
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8516/showart_2049481.html |
|