10 Jun 2010

ひさびさにRedmineセットアップしたらエラーに遭遇

久々にRedmineセットアップしたらちょこちょこ変更があったみたいでエラーに遭遇。メモしておきます。

conf/environment.rbにsession keyの設定をしてない


現在の安定版最新ver0.9.4のenvironment.rbに、Rails2.xのrails自動生成されるonfig.action_controller.session={}が記述されてないみたい。以下のエラーが出ていた。tailしてたら長い長いエラーメッセージに埋もれてしばらく気づかなかった。

  1. The backend application (process 13999) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.  
  2. Exception ArgumentError in application (A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session":secret => "some secret phrase" } in config/environment.rb) (process 13999):  


Web屋の人の日記 || WebJourney 開発ログさんの記事を参考に解決。

config/environment.rb
  1. Rails::Initializer.run do |config|  
  2. :  
  3.   characters = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a  
  4.   secret = Array.new(48){characters[rand(characters.size)]}.join  
  5.   
  6.   config.action_controller.session = {  
  7.     :session_key => "_webjourney_session",  
  8.     :secret => secret  
  9.   }  
  10. :  
  11. end  


Phusion Passengerを使ってる場合Apacheをreloadしてspown serverに構成を再読み込みさせる必要があります。


No route matches "/index.html"


Phusion Passenger を使ってるため以下のエラーに遭遇した。devillikeaangelの日記さんの記事を参考に修正。(まんまコピーですいません)

  1. ActionController::RoutingError (No route matches "/index.html" with {:method=>:get}):  
  2. Rendering /var/rails/redmine/public/404.html (404 Not Found)  


どうもmod_rewriteを有効にしてると、index.htmlを探しに行ってしまうみたい。

以下、対処法の抜粋。

passengerで動かすので、Rewriteはいらない。redmine/public/.htaccessにある以下の3行をコメントアウトする

  1. #RewriteRule ^$ index.html [QSA]  
  2. #RewriteRule ^([^.]+)$ $1.html [QSA]  
  3. #RewriteCond %{REQUEST_FILENAME} !-f  


.