我有一个带有fastcgi的lighttpd服务器和带有以下fcgi配置的web.py:
fastcgi.server = ( "/code.py" =>
(( "socket" => "/tmp/fastcgi.socket",
"bin-path" => "/etc/lighttpd/code/code.py",
"check-local" => "disable",
"max-procs" => 1
)) )
和主配置:
url.rewrite-once = (
"^(.*)/favicon.ico$" => "/static/favicon.ico",
"^/static/(.*)$" => "/static/$1",
"^/code.py(.*)$" => "/code.py/404",
"^/forum(.*)$" => "/code.py/forum/$1"
)
如果我去www.mysite.com/forum一切正常,但如果我去www.mysite.com/code.py/forum我没有被重定向到404,因为我应该,但实际上得到第一个链接。 我基本上想把自己的内部隐藏在外面的世界里。
我查看了错误日志,似乎服务器确实正在重写网址,但它没有什么区别。
(response.c.300) -- splitting Request-URI
(response.c.301) Request-URI : /code.py/forum
(response.c.302) URI-scheme : https
(response.c.303) URI-authority: www.mysite.com
(response.c.304) URI-path : /code.py/forum
(response.c.305) URI-query :
(response.c.300) -- splitting Request-URI
(response.c.301) Request-URI : /code.py/404
(response.c.302) URI-scheme : https
(response.c.303) URI-authority: www.mysite.com
(response.c.304) URI-path : /code.py/404
(response.c.305) URI-query :
(response.c.349) -- sanatising URI
(response.c.350) URI-path : /code.py/404
(mod_access.c.135) -- mod_access_uri_handler called
(mod_fastcgi.c.3609) handling it in mod_fastcgi
(response.c.470) -- before doc_root
(response.c.471) Doc-Root : /var/www/html
(response.c.472) Rel-Path : /code.py
(response.c.473) Path :
(response.c.521) -- after doc_root
(response.c.522) Doc-Root : /var/www/html
(response.c.523) Rel-Path : /code.py
(response.c.524) Path : /var/www/html/code.py
(response.c.541) -- logical -> physical
(response.c.542) Doc-Root : /var/www/html
(response.c.543) Rel-Path : /code.py
(response.c.544) Path : /var/www/html/code.py
(mod_fastcgi.c.3035) got proc: pid: 30262 socket: unix:/tmp/fastcgi.socket-0 load: 1
有什么想法吗?
答案 0 :(得分:1)
尝试这样的事情:
url.rewrite-once = (
"^/favicon\.ico$" => "/static/favicon.ico",
"^/forum(.*)$" => "/forum/code.py$1"
)
$HTTP["url"] =~ "^/forum(.*)$" {
( "/code.py" =>
(( "socket" => "/tmp/fastcgi.socket",
"bin-path" => "/etc/lighttpd/code/code.py",
"check-local" => "disable",
"max-procs" => 1,
"bin-environment" => ("REAL_SCRIPT_NAME" => "")
))
)
}