今天配置服务器很有灵感,大概是今天机品值与人品值均颇高所致,呵呵 :lol:
废话少说,总结一下。希望对lightTPD初学者有所帮助,欢迎讨论,一同进步嘛。
(哎呀,废话还是不少捏)
一、servers.modules :lightTPD运行所要加载的模块
默认形式:
启动模块只要去掉其中注释符号就可(#),关闭某些就不用说了。
此外,还有比较酷的写法,即:servers.modules +=( "mod_fascgi"),熟悉shell的看着眼熟吧。
二、server.document-root : lightTPD网站根目录位置
server.document-root = "/var/www" 什么?这个简单?好吧,耐心点,后面讲mod_evhost应用时,还会用到,相当灵巧。
三、各种日志路径设置参数:
1、server.errorlog : 服务器的错误日志路径参数。 example : server.errorlog = "/var/log/lighttpd/error.log"
2、accesslog.filename : 服务器的访问日志路径参数。 example : accesslog.filename = "/var/log/lighttpd/access.log"
这个又简单吧,知道你就会这么说,后面还会讲到更酷的用法。别急,继续。。。
四、端口与索引
dir-listing.encoding = "utf-8"
端口设置 : server.port = 80 #默认为80
目录索引文件名设置 : index-file.names = ("index.php","index.html","index.htm","Index.php","default.htm")
是否开启目录列表功能,两种写法:
五、其他参数:
怎样,设置都很简单吧,上述都是最基本的设置。其他参数及模块设置参考:[url]http://trac.lighttpd.net/trac/[/url]
下面来点比较酷的用法,也是非常常用的。那就是。。。。。。。。。。。。。虚拟主机的用法。嘎嘎
俺是用的ubuntu系统,由于是apt安装的lightTPD,所以设置很方便。
就拿我的工作机为例吧,公布一下工作机的隐私,提升它的机品值,哈哈。
localhost的设置:
怎么样?酷吧,其他虚拟主机的设置参考以上吧。给我的感觉,lightTPD确实非常light~(靓仔啊)
废话少说,总结一下。希望对lightTPD初学者有所帮助,欢迎讨论,一同进步嘛。
(哎呀,废话还是不少捏)
一、servers.modules :lightTPD运行所要加载的模块
默认形式:
servers.modules = (
"mod_access",
"mod_alias",
# ....
# ....
)
启动模块只要去掉其中注释符号就可(#),关闭某些就不用说了。
此外,还有比较酷的写法,即:servers.modules +=( "mod_fascgi"),熟悉shell的看着眼熟吧。
二、server.document-root : lightTPD网站根目录位置
server.document-root = "/var/www" 什么?这个简单?好吧,耐心点,后面讲mod_evhost应用时,还会用到,相当灵巧。
三、各种日志路径设置参数:
1、server.errorlog : 服务器的错误日志路径参数。 example : server.errorlog = "/var/log/lighttpd/error.log"
2、accesslog.filename : 服务器的访问日志路径参数。 example : accesslog.filename = "/var/log/lighttpd/access.log"
这个又简单吧,知道你就会这么说,后面还会讲到更酷的用法。别急,继续。。。
四、端口与索引
dir-listing.encoding = "utf-8"
端口设置 : server.port = 80 #默认为80
目录索引文件名设置 : index-file.names = ("index.php","index.html","index.htm","Index.php","default.htm")
是否开启目录列表功能,两种写法:
server.dir-listing = "disable" #(关闭) 或者 server.dir-listing = "enable" #(开启)
dir-listing.activate = "disable" #(关闭) 或者 dir-listing.activate = "enable" #(开启)
五、其他参数:
dir-listing.encoding = "utf-8" #目录文件编码
server.pid-file = "/var/run/lighttpd.pid" #进程名称,也可在虚拟目录中单独设定。
server.username = "www-data" #服务用户名(默认)
server.groupname = "www-data" #服务用户组(默认)
alias.url = ("/doc/","/usr/share/doc/") #路径别名设置
怎样,设置都很简单吧,上述都是最基本的设置。其他参数及模块设置参考:[url]http://trac.lighttpd.net/trac/[/url]
下面来点比较酷的用法,也是非常常用的。那就是。。。。。。。。。。。。。虚拟主机的用法。嘎嘎
俺是用的ubuntu系统,由于是apt安装的lightTPD,所以设置很方便。
$ sudo vim /etc/lighttpd/conf-enabled/10-fastcgi.conf # 索性直接编辑这个文件添加虚拟主机。
就拿我的工作机为例吧,公布一下工作机的隐私,提升它的机品值,哈哈。
localhost的设置:
$HTTP["host"] == "localhost" {
server.document-root = "/var/www/" # 设置http://localhost的根目录
alias.url += ("/php" => "/var/www/manual/html") # 设置http://localhost/php别名路径,哈哈,这是我的php手册地址。其实,其中的alias.url中的第一个参数都是正则,酷吧。
alias.url += ("/python" => "/var/www/manual/python") # 设置http://localhost/python别名路径,这是我的python学习资料。
$HTTP["host"] =~ "^/python/" { # 这个写法超酷,翻译过来就是凡是开头以/python的别名请求,执行以下设置。
dir-listing.activate = "enable" # 允许列出目录所有文件
}
}
怎么样?酷吧,其他虚拟主机的设置参考以上吧。给我的感觉,lightTPD确实非常light~(靓仔啊)