1、编辑lighttpd.conf

vim /etc/lighttpd/lighttpd.conf

在最后添加:

include_shell "cat vhosts.d/*.conf"

设置存放虚拟目录配置文件的目录。

2、设置虚拟目录

vim /etc/lighttpd/vhosts.d/www.example.com.conf

添加:

$HTTP["host"] == "www.example.com" {
server.name = "www.example.com"
server.document-root = "/home/www.example.com"
server.errorlog = "/var/log/lighttpd/www.example.com-error.log"
accesslog.filename = "/var/log/lighttpd/www.example.com-access.log"
}

3、建立相关目录

cd /home
mkdir www.example.com
chown -R lighttpd:lighttpd www.example.com/

4、重启Lighttpd

service lighttpd restart

如果没有注册成服务,也可以通过绝对路径重启

/etc/init.d/lighttpd restart

chenxuhua
1 声望1 粉丝

引用和评论

0 条评论