我有
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的/站点包/善变/模板/静态/ HG /静态/ 的风格coal.css 的
答案 0 :(得分:2)
我使用别名来解决此问题:
alias.url = ( "/hg/static" => "/usr/lib/python2.6/site-packages/mercurial/templates/static/" )
但仍然不明白如何使用mod_rewrite ...