lighttpd、mod_rewrite、web.py
我对 lighttpd 和 web.py 有一个小问题。它在 Apache2 上运行得很好,但在 lighttpd 上有一个小问题。
这是我的 lighttpd web.py 配置
fastcgi.server = ("/code.py" =>
((
"socket" => "/tmp/fcgi.socket",
"bin-path" => "/home/ivan/www/code.py",
"max-procs" => 1,
"check-local" => "disable",
))
)
url.rewrite-once = (
"^/favicon.ico$" => "/static/favicon.ico",
"^/static/(.*)$" => "/static/$1",
"^/(.*)$" => "/code.py/$1"
)
和一个示例 web.py,用于演示我如何定义 URL。
urls = (
'/page', 'Page',
'/', 'Index',
)
class Index(object):
def GET(self):
raise web.seeother('/page')
当浏览器重定向到 example.org/page
URL 时会出现此问题。 Apache2 重定向到 example.org/page
,但 lighttpd 重定向到 example.org/code.py/page
。我该如何解决这个小问题?我找到了一个解决方案,所以如果我写 raise web.seeother(web.ctx.homedomain+'/page')
一切都很好,但我想知道它是否可以在 lighttpd 中解决配置文件而不是接触 web.py 代码。
谢谢,
I've a small issue with lighttpd and web.py. It runs perfectly fine on Apache2 but there's a small issue on lighttpd.
Here's my lighttpd config for web.py
fastcgi.server = ("/code.py" =>
((
"socket" => "/tmp/fcgi.socket",
"bin-path" => "/home/ivan/www/code.py",
"max-procs" => 1,
"check-local" => "disable",
))
)
url.rewrite-once = (
"^/favicon.ico$" => "/static/favicon.ico",
"^/static/(.*)$" => "/static/$1",
"^/(.*)$" => "/code.py/$1"
)
and a sample web.py to demonstrate how I've defined to URLs.
urls = (
'/page', 'Page',
'/', 'Index',
)
class Index(object):
def GET(self):
raise web.seeother('/page')
The problem occurs when the browser is redirected to example.org/page
URL. Apache2 redirects to example.org/page
but lighttpd redirects to example.org/code.py/page
. How can I fix this small issue? I've found a solution, so if I write raise web.seeother(web.ctx.homedomain+'/page')
everything is fine but I'd like to know if it can be solved in lighttpd config file instead of touching the web.py code.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在使用 fastcgi 生成脚本之前,只需设置
它应该可以工作。
Before spawning your script with fastcgi just set
this should work.