六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 76|回复: 0

lighttpd安装学习文档

[复制链接]

升级  8%

64

主题

64

主题

64

主题

举人

Rank: 3Rank: 3

积分
224
 楼主| 发表于 2013-1-16 16:45:40 | 显示全部楼层 |阅读模式
早就听说了有个可以替代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
之后就可以看到我们刚刚建立的简单的页面了
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表