lighttpd安装学习文档

早就听说了有个可以替代apache的产品了,就是lighttpd,今天尝试安装配置了一下,把过程总结如下

前提条件 需要安装pcre

pcre是一个和perl兼容的正规表达式库, 当然不安装他lighttpd也可以正常运行,但是这样一来就无法使用正则来进行复杂配置了, pcre对于支持rails,虚拟主机还是很有必要的, pcre的主站 ,linux下面本人的机器默认有安装, solaris上没有内置,需要下载安装, solaris到这里 找对应的版本

下载好pcre后,解压进入相应目录,按照下面的方式编译安装即可
./configure --enable-utf8 --enable-unicode-properties --enable-bsr-anycrlf --enable-pcregrep-libz --enable-pcregrep-libbz2
make
make install

Lighttpd的安装
可以到lighttpd的
主站 进行下载,目前最新版本是lighttpd-1.4.19.tar.gz
wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz
tar zxvf lighttpd-1.4.19.tar.gz
cd lighttpd-1.4.19
./configure --prefix=/usr/local/lighttpd
make
make install

mkdir -p /usr/local/lighttpd/conf
vi /usr/local/lighttpd/conf/lighttpd.conf

server.port = 80
server.modules = (
                        "mod_access" ,
                        "mod_accesslog" )
server.document-root = "/usr/local/lighttpd/doc/"
server.errorlog = "/usr/local/lighttpd/var/logs/error.log"
server.pid-file = "/usr/local/lighttpd/lighttpd.pid"
index-file.names = ( "index.html" )
mimetype.assign = (
                        ".html" => "text/html" ,
                        ".js" => "text/javascript" )
server.max-keep-alive-requests = 4000
dir-listing.activate = "disable"

accesslog.filename = "/usr/local/lighttpd/var/logs/access.log"

$HTTP["host" ] =="www.test.com" {
        server.name ="www.test.com"
        server.document-root ="/usr/local/lighttpd/doc/"
        server.errorlog ="/usr/local/lighttpd/var/logs/test-error.log"
        accesslog.filename ="/usr/local/lighttpd/var/logs/test-access.log"
}

mkdir -p /usr/local/lighttpd/doc
mkdir -p /usr/local/lighttpd/var/logs
使用 /usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/conf/lighttpd.conf
启动服务

在doc文件夹下建立index.html文件,加入内容如下

< body >
this is a test page!!!
< / body >

保存退出后,在自己电脑的hosts文件加入相应的解析
然后通过http://www.test.com
之后就可以看到我们刚刚建立的简单的页面了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值