使用新文档根重写 lighttpd 规则将不起作用

发布于 2024-12-09 21:18:19 字数 811 浏览 0 评论 0原文

我有

server.document-root = "/srv/www"

一些静态文件,但我想使用另一个文档根目录。我尝试使用此代码:

$HTTP["url"] =~ "^/hg/static" {
    url.rewrite-once = ("^/hg/static" => "/")
    server.document-root = "/usr/lib/python2.6/site-packages/mercurial/templates/static/"
}

但在 error.log 中出现错误:

2011-10-13 12:00:16: (/response.c.539) -- file not found 
2011-10-13 12:00:16: (/response.c.540) Path : /usr/lib/python2.6/site-packages/mercurial/templates/static/hg/static/style-coal.css 

尝试时:

  $ wget http://localhost/hg/static/style-coal.css

请求文件的真实路径为 /usr/lib/python2.6/site-packages/mercurial/templates /static/style-coal.css 但服务器尝试找到 /usr/lib/python2.6/site-packages/mercurial/templates/static/hg/static/style -煤炭.css

I have

server.document-root = "/srv/www"

but for some static files I want use another document-root. I try use this code:

$HTTP["url"] =~ "^/hg/static" {
    url.rewrite-once = ("^/hg/static" => "/")
    server.document-root = "/usr/lib/python2.6/site-packages/mercurial/templates/static/"
}

but I get error in error.log:

2011-10-13 12:00:16: (/response.c.539) -- file not found 
2011-10-13 12:00:16: (/response.c.540) Path : /usr/lib/python2.6/site-packages/mercurial/templates/static/hg/static/style-coal.css 

when try:

  $ wget http://localhost/hg/static/style-coal.css

Real path to requested file is /usr/lib/python2.6/site-packages/mercurial/templates/static/style-coal.css but server try locate /usr/lib/python2.6/site-packages/mercurial/templates/static/hg/static/style-coal.css

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〗斷ホ乔殘χμё〖 2024-12-16 21:18:19

我使用别名来解决这个问题:

alias.url = ( "/hg/static" => "/usr/lib/python2.6/site-packages/mercurial/templates/static/" )

但仍然不明白如何用 mod_rewrite 来解决这个问题...

I use alias to resolve this problem:

alias.url = ( "/hg/static" => "/usr/lib/python2.6/site-packages/mercurial/templates/static/" )

but still don't understand how archieve this with mod_rewrite...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文