开发者

lighttpd, mod_rewrite, 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.o开发者_C百科rg/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,


Before spawning your script with fastcgi just set

export REAL_SCRIPT_NAME=""

this should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜