Redmine + Lighttpd:无法加载 JavaScript(404)

发布于 2024-12-18 20:16:04 字数 7254 浏览 2 评论 0原文

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

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

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

$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???

I've a strange problem with my redmine/lighttpd installation under ubuntu 11.10. I've installed and configured redmine and it's working like it should be but: everything works fine except that all javascript files under /javascripts are not found!? But everything under "/stylesheets" or "/themes" is loaded properly.

The strange thing is that when I call "myserver.com/javascripts/" it returns 404. If I copy the javascripts directory to "js" and call "myserver.com/js/" I get the directory listing from lighttpd!

This is my lighttpd.conf for my redmine installation:

$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"
            ),
        ))
    )
}

Any ideas???

Edit:

I've put an debug.log-request-handling = "enable" in my lighttpd.conf.

I get this for calling "/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 

And this for calling "/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 

Why is there this jump from /var/www/redmine to /usr/share?????

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事还在继续 2024-12-25 20:16:04

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

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

我只是将

sudo lighty-disable-mod javascript-alias

其跟踪到 javascript-common 包。

感谢您发布调试信息,它帮助我确定 mod_alias 是问题的原因。

Had the same issue and finally solved it: You probably have the javascript-alias mod enabled which contains

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

Just do

sudo lighty-disable-mod javascript-alias

I tracked it down to the javascript-common package.

Thanks for posting the debug info, it helped me a lot to identify mod_alias as the cause of the problem.

惯饮孤独 2024-12-25 20:16:04

根据您提供的信息,javascript 文件夹是引用 /usr/share/javascripts 的符号链接。

From the information you present the javascript folder is a symlink referencing /usr/share/javascripts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文