一,Linux下使用lighttpd
lighttpd在支持纯静态的对象时,比如图片,文件等 ,
lighttpd速度更快,更理想
二,从何处下载lighttpd
http://www.lighttpd.net/download/
三,安装
1,编译安装
./configure –prefix=/usr/local/lighttpd
make
make install
configure完毕以后,会给出一个激活的模块和没有激活模块的清单,可以检查一下,是否自己需要的模块都已经激活,在enable的模块中一定要有“mod_rewrite”这一项,否则重新检查pcre是否安装。
2,编译后配置
建立一个使用者来执行 lighttpd
可以下指令 useradd lighttpd
记得要把 /etc/passwd 的 lighttpd 这个 user 的shell从 /bin/bash 改成 /bin/nologin
在 /usr/local/lighttpd 下建立 conf 文件夹与 logs 文件夹
然后把 配置文件(在doc/config目录下的所有文件)放到 conf 文件夹下,修改lighttpd.conf的log_root, server_root, conf_dir等项目
更改/usr/local/lighttpd 目录的权限为lighttpd用户所有:
chown lighttpd.lighttpd /usr/local/lighttpd -Rf
3,测试运行
/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/conf/lighttpd.conf