I have a lighttpd server with fastcgi and web.py with the following fcgi configuration:
fastcgi.server = ( "/code.py" =>
(( "socket" => "/tmp/fastcgi.socket",
"bin-path" => "/etc/lighttpd/code/code.py",
"check-local" => "disable",
"max-procs" => 1
)) )
and main config:
url.rewrite-once = (
"^(.*)/favicon.ico$" => "/static/favicon.ico",
"^/static/(.*)$" => "/static/$1",
"^/code.py(.*)$" => "/code.py/404",
"^/forum(.*)$" => "/code.py/forum/$1"
)
If I go to www.mysite.com/forum everything works as it's supposed to, but if I go to www.mysite.com/code.py/forum I am not redirected to a 404 as I'm supposed to, but actually get the first link. I basically want to hide my internals from the outside world.
I looked in the error log and it seems that the server is indeed rewriting the url, and yet it doesn't make a difference.
(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
Any ideas?
Try something like this:
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" => "")
))
)
}