翻译lighttpd的配置文件(抛砖引玉~~~)

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
头像
追疯少年
帖子: 950
注册时间: 2008-03-13 23:37
联系:

翻译lighttpd的配置文件(抛砖引玉~~~)

#1

帖子 追疯少年 » 2008-12-29 0:44

# Debian lighttpd configuration file
#

############ Options you really have to take care of ####################

## modules to load
# mod_access, mod_accesslog and mod_alias are loaded by default
# all other module should only be loaded if neccesary
# - saves some time
# - saves memory

server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_compress",
# "mod_rewrite",
# "mod_redirect",
# "mod_status",
# "mod_evhost",
# "mod_usertrack",
# "mod_rrdtool",
# "mod_webdav",
# "mod_expire",
# "mod_flv_streaming",
# "mod_evasive"
)

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root = "/var/www/" 设定你的服务器的目录,一切的文件操作都在这里

## where to send error-messages to
server.errorlog = "/var/log/lighttpd/error.log" 错误记录文件

## files to check for if .../ is requested
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
"index.lighttpd.html" ) 文件检索顺序。如果有这样的htm/html文件,就会显示网页,没的话就显示目录


## Use the "Content-Type" extended attribute to obtain mime type if possible
# mimetype.use-xattr = "enable" 这个没看明白~大虾们指点~

#### accesslog module
accesslog.filename = "/var/log/lighttpd/access.log" 接入记录文件

## deny access the file-extensions
#
# ~ is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
# of the document-root
url.access-deny = ( "~", ".inc" )

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )


######### Options that are good to be but not neccesary to be changed #######

## bind to port (default: 80)
# server.port = 81 设置接入端口,不需要改动

## bind to localhost only (default: all interfaces)
## server.bind = "localhost" 在你的火狐里输入“localhost”和输入数字的ip地址是一样的

## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"

## to help the rc.scripts
server.pid-file = "/var/run/lighttpd.pid"

##
## Format: <errorfile-prefix><status>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/var/www/"

## virtual directory listings
dir-listing.encoding = "utf-8"
server.dir-listing = "enable" 允许查看目录

## send unhandled HTTP-header headers to error-log
#debug.dump-unknown-headers = "enable"

### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot = "/"

## change uid to <uid> (default: don't care)
server.username = "www-data"

## change uid to <uid> (default: don't care)
server.groupname = "www-data"

#### compress module
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ("text/plain", "text/html", "application/x-javascript", "text/css")

#### status module
# status.status-url = "/server-status"
# status.config-url = "/server-config"

#### url handling modules (rewrite, redirect, access)
# url.rewrite = ( "^/$" => "/server-status" )
# url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )

#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"

#### expire module
# expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")

#### rrdtool
# rrdtool.binary = "/usr/bin/rrdtool"
# rrdtool.db-name = "/var/www/lighttpd.rrd"


#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"

## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")


#### external configuration files
## mimetype mapping
include_shell "/usr/share/lighttpd/create-mime.assign.pl"

## load enabled configuration files,
## read /etc/lighttpd/conf-available/README first
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

#### handle Debian Policy Manual, Section 11.5. urls
### by default allow them only from localhost
### (This must come last due to #445459)
$HTTP["remoteip"] == "127.0.0.1" {
alias.url += (
"/doc/" => "/usr/share/doc/",
"/images/" => "/usr/share/images/"
)
$HTTP["url"] =~ "^/doc/|^/images/" {
dir-listing.activate = "enable"
}
}


就知道这么多啦!希望高手们帮忙补全!
头像
追疯少年
帖子: 950
注册时间: 2008-03-13 23:37
联系:

Re: 翻译lighttpd的配置文件(抛砖引玉~~~)

#2

帖子 追疯少年 » 2008-12-31 10:44

怎么没人跟帖呢???

不会没高人在???

顶起!!!!
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 翻译lighttpd的配置文件(抛砖引玉~~~)

#3

帖子 eexpress » 2008-12-31 10:53

这软件,连stop都不行,还要kill。不好吧。
直接thttpd算了。
● 鸣学
头像
追疯少年
帖子: 950
注册时间: 2008-03-13 23:37
联系:

Re: 翻译lighttpd的配置文件(抛砖引玉~~~)

#4

帖子 追疯少年 » 2008-12-31 11:41

eexpress 写了:这软件,连stop都不行,还要kill。不好吧。
直接thttpd算了。
谢谢你的推荐!!!

其实lighttpd, thttpd, shttpd - 都很好!!!
看看下面的介绍:
lighttpd
官方主页:www.lighttpd.net
Lighttpd是一个德国人领导的开源软件,其根本的目的是提供一个专门针对高性能网站,安全、快速、兼容性好并且灵活的web server环境。具有非常低的内存开销,cpu占用率低,效能好,以及丰富的模块等特点。

lighttpd 是众多OpenSource轻量级的web server中较为优秀的一个。支持FastCGI, CGI, Auth, 输出压缩(output compress), URL重写, Alias等重要功能,而Apache之所以流行,很大程度也是因为功能丰富,在lighttpd上很多功能都有相应的实现了,这点对于apache的用户是非常重要的,因为迁移到lighttpd就必须面对这些问题。

在google搜索了一下,简体中文介绍lighttpd的文章几乎没有,大多数都是台湾同胞的Big5内容。因此在接下来的时间里,想好好写一篇介绍lighttpd,以及简单的benchmark的文章。

实用起来lighttpd确实非常不错,上文提到的apache overload的问题,用lighttpd就完全解决了。apache主要的问题是密集并发下,不断的fork()和切换,以及较高(相对于 lighttpd而言)的内存占用,使系统的资源几尽枯竭。而lighttpd采用了Multiplex技术,代码经过优化,体积非常小,资源占用很低,而且反应速度相当快。

利用apache的rewrite技术,将繁重的cgi/fastcgi任务交给lighttpd来完成,充分利用两者的优点,现在那台服务器的负载下降了一个数量级,而且反应速度也提高了一个甚至是2个数量级!


thttpd

官方网站:http://www.acme.com/software/thttpd/
thttpd 是一个非常小巧的轻量级web server,它非常非常简单,仅仅提供了HTTP/1.1和简单的CGI支持,在其官方网站上有一个与其他web server(如Apache, Zeus等)的对比图+Benchmark,可以参考参考。此外,thttpd 也类似于lighttpd,对于并发请求不使用fork()来派生子进程处理,而是采用多路复用(Multiplex)技术来实现。因此效能很好。

Thttpd支持多种平台,如FreeBSD, SunOS, Solaris, BSD, Linux, OSF等。对于小型web server而言,速度快似乎是一个代名词,通过官方站提供的Benchmark,可以这样认为:thttpd至少和主流的web server一样快,在高负载下更快,因为其资源占用小的缘故。

Thttpd还有一个较为引人注目的特点:基于URL的文件流量限制,这对于下载的流量控制而言是非常方便的。象Apache就必须使用插件实现,效率较thttpd低。

shttpd
官方网站:http://shttpd.sourceforge.net/Shttpd是另一个轻量级的web server,具有比thttpd更丰富的功能特性,支持CGI, SSL, cookie, MD5认证, 还能嵌入(embedded)到现有的软件里。最有意思的是不需要配置文件!
由于shttpd可以嵌入其他软件,因此可以非常容易的开发嵌入式系统的web server,官方网站上称shttpd如果使用uclibc/dielibc(libc的简化子集)则开销将非常非常低。以下是其特点:

Stand-alone server, or embeddable into existing C/C++ program
GET, POST, PUT, DELETE methods
CGI
SSL
Digest (MD5) authorization
Multiple (and user defineable) index files
Directory listing
Standard logging
Cookies
inetd mode
User-defineable mime types
No configuration files
No external dependencies

由于shttpd可以轻松嵌入其他程序里,因此shttpd是较为理想的web server开发原形,开发人员可以基于shttpd开发出自己的webserver!
回复