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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。