我正在尝试让 Redmine(一个 Ruby on Rails 应用程序)正常工作。当使用 ruby script/server webrick -e production
启动时它工作正常,但是,我在 Apache 中使用 Passenger 时遇到问题。
正在访问 http://example.com/redmine返回 Redmine 主页,但单击任何链接(甚至向 URL 添加 /
)都会导致 404。根据 Rails 日志,发生了 RoutingError
。例如,当打开项目页面时:ActionController::RoutingError (No route matches "/projects.html"with {:method=>:get})
Redmine 目录是 /var/www/localhost/htapps/redmine
。我遵循了 http://www.modrails.org/documentation/Users%20guide.html#_deploying_a_ruby_on_rails_application 上的文档(第 3.2 节),所以在 /var/www/localhost/htdocs/redmine
有一个指向 ../htapps/redmine/public
的符号链接(symbolic link),并且 Apache 配置包含DocumentRoot/var/www/localhost/htdocs
和 RailsBaseURI/redmine
。
是什么导致它引发这些 RoutingErrors?
最佳答案
看起来这个问题实际上是由 Redmine 中包含的默认 .htaccess 引起的。
Redmine 的 .htaccess
重写每个以 .html 结尾的请求。 Redmine 的路由需要 .html-less 请求。
将 RewriteEngine
设置为 Off
为我解决了这个问题。
关于ruby-on-rails - Redmine 在 Apache 中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/996364/