早就听说了有个可以替代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
|
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文件,加入内容如下
|
保存退出后,在自己电脑的hosts文件加入相应的解析
然后通过http://www.test.com
之后就可以看到我们刚刚建立的简单的页面了