Redmine + Lighttpd:加载javascript失败(404)



我在ubuntu 11.10下安装redmine/lighttpd时遇到了一个奇怪的问题。我已经安装和配置了redmine,它的工作方式应该是,但是:一切工作正常,除了/javascripts下的所有javascript文件都找不到!但"/stylesheets"或"/themes"下的所有内容都可以正常加载。

奇怪的是,当我调用"myserver.com/javascripts/"时,它返回404。如果我将javascripts目录复制到"js"并调用"myserver.com/js/",我将从lighttpd获得目录列表!

这是我的lighttpd.conf为我的redmine安装:

$HTTP["host"] == "myserver.com" {
    server.document-root = "/var/www/redmine/public/"
    server.indexfiles = ( "dispatch.fcgi" )
    server.error-handler-404 = "/dispatch.fcgi"
    server.errorlog = "/var/log/lighttpd/redmine/error.log"
    accesslog.filename = "/var/log/lighttpd/redmine/access.log"
    fastcgi.server    = ( ".fcgi" =>
        ((
            "bin-path" => "/var/www/redmine/public/dispatch.fcgi",
            "socket" => "/tmp/ruby-rails.socket",
            "max-procs" => 5,
            "idle-timeout" => 20,
            "bin-environment" => (
                "RAILS_ENV" => "production",
                "RAILS_ROOT" => "/var/www/redmine"
            ),
        ))
    )
}

有什么想法?

编辑:

我已经在我的lighttpd.conf中添加了debug.log-request-handling = "enable"。

我得到这个调用"/stylesheets":

2011-12-01 11:25:58: (response.c.300) -- splitting Request-URI 
2011-12-01 11:25:58: (response.c.301) Request-URI  :  /stylesheets/ 
2011-12-01 11:25:58: (response.c.302) URI-scheme   :  http 
2011-12-01 11:25:58: (response.c.303) URI-authority:  redmine.musik-sammler.de 
2011-12-01 11:25:58: (response.c.304) URI-path     :  /stylesheets/ 
2011-12-01 11:25:58: (response.c.305) URI-query    :   
2011-12-01 11:25:58: (response.c.349) -- sanatising URI 
2011-12-01 11:25:58: (response.c.350) URI-path     :  /stylesheets/ 
2011-12-01 11:25:58: (response.c.470) -- before doc_root 
2011-12-01 11:25:58: (response.c.471) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:25:58: (response.c.472) Rel-Path     : /stylesheets/ 
2011-12-01 11:25:58: (response.c.473) Path         :  
2011-12-01 11:25:58: (response.c.521) -- after doc_root 
2011-12-01 11:25:58: (response.c.522) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:25:58: (response.c.523) Rel-Path     : /stylesheets/ 
2011-12-01 11:25:58: (response.c.524) Path         : /var/www/redmine/public/stylesheets/ 
2011-12-01 11:25:58: (response.c.541) -- logical -> physical 
2011-12-01 11:25:58: (response.c.542) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:25:58: (response.c.543) Rel-Path     : /stylesheets/ 
2011-12-01 11:25:58: (response.c.544) Path         : /var/www/redmine/public/stylesheets/ 
2011-12-01 11:25:58: (response.c.561) -- handling physical path 
2011-12-01 11:25:58: (response.c.562) Path         : /var/www/redmine/public/stylesheets/ 
2011-12-01 11:25:58: (response.c.569) -- file found 
2011-12-01 11:25:58: (response.c.570) Path         : /var/www/redmine/public/stylesheets/ 
2011-12-01 11:25:58: (response.c.719) -- handling subrequest 
2011-12-01 11:25:58: (response.c.720) Path         : /var/www/redmine/public/stylesheets/ 
2011-12-01 11:25:58: (mod_indexfile.c.150) -- handling the request as Indexfile 
2011-12-01 11:25:58: (mod_indexfile.c.151) URI          : /stylesheets/ 
2011-12-01 11:25:58: (mod_compress.c.683) -- handling file as static file 
2011-12-01 11:25:58: (mod_dirlisting.c.922) -- handling the request as Dir-Listing 
2011-12-01 11:25:58: (mod_dirlisting.c.923) URI          : /stylesheets/ 
2011-12-01 11:25:58: (response.c.731) -- subrequest finished 

调用"/javascripts":

2011-12-01 11:24:38: (response.c.300) -- splitting Request-URI 
2011-12-01 11:24:38: (response.c.301) Request-URI  :  /javascripts/ 
2011-12-01 11:24:38: (response.c.302) URI-scheme   :  http 
2011-12-01 11:24:38: (response.c.303) URI-authority:  redmine.musik-sammler.de 
2011-12-01 11:24:38: (response.c.304) URI-path     :  /javascripts/ 
2011-12-01 11:24:38: (response.c.305) URI-query    :   
2011-12-01 11:24:38: (response.c.349) -- sanatising URI 
2011-12-01 11:24:38: (response.c.350) URI-path     :  /javascripts/ 
2011-12-01 11:24:38: (response.c.470) -- before doc_root 
2011-12-01 11:24:38: (response.c.471) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:24:38: (response.c.472) Rel-Path     : /javascripts/ 
2011-12-01 11:24:38: (response.c.473) Path         :  
2011-12-01 11:24:38: (response.c.521) -- after doc_root 
2011-12-01 11:24:38: (response.c.522) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:24:38: (response.c.523) Rel-Path     : /javascripts/ 
2011-12-01 11:24:38: (response.c.524) Path         : /var/www/redmine/public/javascripts/ 
2011-12-01 11:24:38: (response.c.541) -- logical -> physical 
2011-12-01 11:24:38: (response.c.542) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:24:38: (response.c.543) Rel-Path     : /javascripts/ 
2011-12-01 11:24:38: (response.c.544) Path         : /usr/share/javascripts/ 
2011-12-01 11:24:38: (response.c.561) -- handling physical path 
2011-12-01 11:24:38: (response.c.562) Path         : /usr/share/javascripts/ 
2011-12-01 11:24:38: (response.c.618) -- file not found 
2011-12-01 11:24:38: (response.c.619) Path         : /usr/share/javascripts/ 
2011-12-01 11:24:38: (response.c.300) -- splitting Request-URI 
2011-12-01 11:24:38: (response.c.301) Request-URI  :  /dispatch.fcgi 
2011-12-01 11:24:38: (response.c.302) URI-scheme   :  http 
2011-12-01 11:24:38: (response.c.303) URI-authority:  redmine.musik-sammler.de 
2011-12-01 11:24:38: (response.c.304) URI-path     :  /dispatch.fcgi 
2011-12-01 11:24:38: (response.c.305) URI-query    :   
2011-12-01 11:24:38: (response.c.349) -- sanatising URI 
2011-12-01 11:24:38: (response.c.350) URI-path     :  /dispatch.fcgi 
2011-12-01 11:24:38: (response.c.470) -- before doc_root 
2011-12-01 11:24:38: (response.c.471) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:24:38: (response.c.472) Rel-Path     : /dispatch.fcgi 
2011-12-01 11:24:38: (response.c.473) Path         :  
2011-12-01 11:24:38: (response.c.521) -- after doc_root 
2011-12-01 11:24:38: (response.c.522) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:24:38: (response.c.523) Rel-Path     : /dispatch.fcgi 
2011-12-01 11:24:38: (response.c.524) Path         : /var/www/redmine/public/dispatch.fcgi 
2011-12-01 11:24:38: (response.c.541) -- logical -> physical 
2011-12-01 11:24:38: (response.c.542) Doc-Root     : /var/www/redmine/public/ 
2011-12-01 11:24:38: (response.c.543) Rel-Path     : /dispatch.fcgi 
2011-12-01 11:24:38: (response.c.544) Path         : /var/www/redmine/public/dispatch.fcgi 
2011-12-01 11:24:38: (response.c.561) -- handling physical path 
2011-12-01 11:24:38: (response.c.562) Path         : /var/www/redmine/public/dispatch.fcgi 
2011-12-01 11:24:38: (response.c.569) -- file found 
2011-12-01 11:24:38: (response.c.570) Path         : /var/www/redmine/public/dispatch.fcgi 
2011-12-01 11:24:38: (response.c.719) -- handling subrequest 
2011-12-01 11:24:38: (response.c.720) Path         : /var/www/redmine/public/dispatch.fcgi 
2011-12-01 11:24:38: (mod_compress.c.683) -- handling file as static file 
2011-12-01 11:24:38: (mod_fastcgi.c.3703) handling it in mod_fastcgi 

为什么从/var/www/redmine跳转到/usr/share?????

有同样的问题,并最终解决了它:您可能已经启用了javascript-alias mod,其中包含

alias.url += ("/javascript" => "/usr/share/javascript")

只做

sudo lighty-disable-mod javascript-alias

我找到了javascript-common包。

感谢您发布的调试信息,它帮助我识别mod_alias作为问题的原因。

从您提供的信息javascript文件夹是一个符号链接引用/usr/share/javascripts。

相关内容

最新更新