我运行lighttpd 1.5刚刚编译closuressvn。
我有一个Trac守护进程监听8000端口,我想代理所有匹配^http://xx.xx.xx.xx/trac(*.)请求到守护进程。
这是它在我的.conf中的样子:
$HTTP["host"] == "xx.xx.xx.xx" { $HTTP["url"] =~ "^/trac" { proxy-core.balancer = "round-robin" proxy-core.protocol = "http" proxy-core.backends = ( "127.0.0.1:8000" ) proxy-core.rewrite-response = ( "Location" => ( "^http://xx\.xx\.xx\.xx/(.*)" => http://xx.xx.xx.xx/trac/$1" ), ) proxy-core.rewrite-request = ( "_uri" => ( "^/trac/?(.*)" => "/$1" ), "Host" => ( ".*" => "xx.xx.xx.xx" ), )
}
xx.xx.xx.xx是可以公开访问的IP,在端口80上。
部分原因是因为当我浏览到http://xx.xx.xx.xx/trac我在Trac中看到了我的可用项目(即由127.0.0.1:8000/服务的页面),而其他任何不以/ trac显示它应该是什么,从docroot的内容。
我唯一的问题是该网页上的链接指向http://xx.xx.xx.xx/projectname ,而他们应该指向http://xx.xx.xx.xx/trac/projectname 。 如果我在url栏中手动inputhttp://xx.xx.xx.xx/trac/projectname ,我会从Trac( 127.0.0.1:8000/projectname ,即该项目的主页)中获得正确的页面,但是与所有链接/图像/样式表/等。 破解并指向http://xx.xx.xx.xx/projectname/*而不是http://xx.xx.xx.xx/trac/projectname 。
我想知道如何解决这个问题,从维基反向代理的代码来看,我认为我可以使用它,但我似乎无法重写任何链接或资源(图像/样式表等)。 。
万一重要,trac守护进程返回的页面中的所有path都是相对的。 (从/ projectname开始)
另外,这是我在Firefox中得到的回应:
Status=OK - 200 Server=tracd/0.12.1 Python/2.5.2 Date=Fri, 04 Feb 2011 00:30:07 GMT Cache-Control=must-revalidate Content-Type=text/html;charset=utf-8 Content-Length=381
感谢您的帮助!