首页 > 代码库 > lighttpd基本配置

lighttpd基本配置

由于工作中需要用到lighttpd,自己安装了一个,遇到了一些问题记录如下:

(1)安装

只需要下面3步即可:

./configure --prefix=/home/users/xxx/lighttpd/lighttpd-1.4.20-bin
make
make install


(2)到安装之后的目录下创建2个文件夹

mkdir logs

mkdir html


(3)修改配置文件

server.port = 8321
server.modules = (
                                "mod_access",
                                "mod_accesslog" )
server.document-root = "/home/users/xxx/lighttpd/lighttpd-1.4.20-bin/html/"
server.errorlog = "/home/users/xxx/lighttpd/lighttpd-1.4.20-bin/logs/error.log"
server.pid-file = "/home/users/xxx/lighttpd/lighttpd-1.4.20-bin/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 = "/home/users/xxx/lighttpd/lighttpd-1.4.20-bin/logs/access.log"


(4)修改html文件

<body>
hello lighttpd
</body>


(5)启动lighttpd

./lighttpd -D -f lighttpd.conf -m ../lib/ &

注意启动的时候必须指明lib的位置,否则会报如下错误:

2014-08-22 16:19:32: (plugin.c.165) dlopen() failed for: /home/users/xxx/lighttpd/lighttp-1.4.20-bin/lib/mod_indexfile.so /home/users/xxx/lighttpd/lighttp-1.4.20-bin/lib/mod_indexfile.so: cannot open shared object file: No such file or directory 
2014-08-22 16:19:32: (server.c.610) loading plugins finally failed 


(6)测试


ok,至此搭建了一个最简单可用的lighttpd服务!

lighttpd基本配置