您的位置:首页 > 其它

使用内存映射文件在进程之间共享数据

2010-12-09 15:50 477 查看
lighttpd配置: #加载fastcgi模块
server.modules += ( "mod_fastcgi" ) #定义一个新的web服务在81端口
$SERVER["socket"] == "0.0.0.0:81"{
server.document-root = "/home/hg/hgserver/"
#下面是认证的配置
#auth.debug = 2
auth.backend = "plain"
auth.backend.plain.userfile = "/etc/lighttpd/lighttpd_plain.user"
#auth.backend = "htdigest"
#auth.backend.htdigest.userfile = "/etc/lighttpd/lighttpd.user"
auth.require = ("/" => (
"method" => "digest",
"realm" => "Mercurial Repository",
"require" => "valid-user"
#"require" => "user=see|user=test"
)) #fastcgi配置
fastcgi.server=(
"/hg_fastcgi.fcgi" =>(
"hg" => (
"bin-path" => "/usr/bin/python /home/hg/hgserver/hg_fastcgi.py socket=/tmp/hg.socket-0",
"socket" => "/tmp/hg.socket",
"min-procs" => 1,
"max-procs" => 1,
"idle-timeout" => 120,
"check-local" => "disable",
)
),
) ## error-handler for status 404
##server.error-handler-404 = "/app.fcgi" url.rewrite-once = (
"^(/.*)$" => "/hg_fastcgi.fcgi$1",
)
} 注意事项: 1.刚开始加认证部分时,出现个怪异情况:lighttpd启动正常,ie或firefox链接那需要认证的url时,很久没反应,一直在读取状态;用sniffer查看网络包,发现lighttpd返回了需要认证并在header中有connection close信息,但连接一直不断开。后来,将认证配置移到fastcgi配置之前,将认证模块加载也放在部分模块之前,这怪异问题就解决了。 2.lighttpd也可以象apache那样,由lighttpd动态启动、管理fcgi程序。这个方法google了很多文章都没有讲,一般都是fcgi程序需要独立运行。配置如上,bin-path是设置启动命令,这里传了个socket参数给fcgi程序。这里需要注意:fastcgi配置的socket参数是"/tmp/hg.socket",而fcgi程序的socket=socket=/tmp/hg.socket-0,多了-0。由于lighttpd可以启动多个fcgi程序(上面配置max-procs=1,最多只启动一个fcgi),那多个fcgi程序需要使用多个unix socket与lighttpd通讯。lighttpd默认会依次加入-0~-N。不过这个对socket的修改好像并没有通知给fcgi,不知道某个fcgi中如何知道使用的是socket-几? 3.具体lighttpd的fastcgi配置参考:http://redmine.lighttpd.net/projects/1/wiki/Docs:ModFastCGI hg server配置与运行脚本:(看附件)

附件中包含:google得来的文档、配置文件、脚本
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: