2012-10-12 65 views
1

我在安裝Redmine時遇到了問題。它似乎在webrick下運行得很好,像這樣:Apache2 + Passenger + Redmine的問題

[email protected]:~$ /usr/bin/ruby1.8 script/rails server webrick -e production 

請注意,這是當我以用戶'redmine'登錄時。

我安裝了客運(v3.0.17)對我現有的Apache2安裝和使用這樣的/etc/apache2/mods-enabled/passenger.conf:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so 
PassengerDefaultUser www-data 
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17 
PassengerRuby /usr/bin/ruby1.8 

我的虛擬主機的conf也很簡單:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName redmine.machine.com 

    RailsEnv production 

    DocumentRoot /home/redmine/redmine-2.1/public 

    <Directory /home/redmine/redmine-2.1/public> 
     # This relaxes Apache security settings. 
     AllowOverride all 
     # MultiViews must be turned off. 
     Options -MultiViews 
    </Directory> 


    # Possible values include: debug, info, notice, warn, error, crit, 
    # alert, emerg. 
    LogLevel warn 
    ErrorLog /var/log/apache2/redmine.error.log 
    CustomLog /var/log/apache2/redmine.access.log combined 
</VirtualHost> 

當我運行它,我得到一個錯誤「沒有這樣的文件來加載 - 打捆」。但是,請注意:

[email protected]:~$ gem list 

*** LOCAL GEMS *** 

actionmailer (3.2.8) 
actionpack (3.2.8) 
activemodel (3.2.8) 
activerecord (3.2.8) 
activerecord-mysql2-adapter (0.0.3) 
activeresource (3.2.8) 
activesupport (3.2.8) 
arel (3.0.2) 
builder (3.0.0) 
bundler (1.2.1) 
coderay (1.0.8) 
daemon_controller (1.0.0) 
erubis (2.7.0) 
fastercsv (1.5.5) 
fastthread (1.0.7) 
hike (1.2.1) 
i18n (0.6.1) 
journey (1.0.4) 
jquery-rails (2.0.3) 
json (1.7.5) 
mail (2.4.4) 
mime-types (1.19) 
multi_json (1.3.6) 
mysql (2.8.1) 
mysql2 (0.3.11) 
net-ldap (0.3.1) 
passenger (3.0.17) 
pg (0.14.1) 
polyglot (0.3.3) 
rack (1.4.1) 
rack-cache (1.2) 
rack-openid (1.3.1) 
rack-ssl (1.3.2) 
rack-test (0.6.2) 
rails (3.2.8) 
railties (3.2.8) 
rake (0.9.2.2) 
rdoc (3.12) 
rmagick (2.13.1) 
ruby-openid (2.1.8) 
rvm (1.11.3.5) 
sprockets (2.1.3) 
sqlite3 (1.3.6) 
thor (0.16.0) 
tilt (1.3.3) 
treetop (1.4.11) 
tzinfo (0.3.33) 

/home/redmine/redmine-2.1所有文件將通過redmine:redmine擁有。所有目錄均爲0755,所有文件爲0644

現在,當我告訴進程我已經注意到有趣的事情:

[email protected]:~$ ps -ef | grep "Passenger" 
root  21764 21759 0 10:49 ?  00:00:00 PassengerWatchdog 
root  21773 21764 0 10:49 ?  00:00:00 PassengerHelperAgent 
root  21775 21773 0 10:49 ?  00:00:00 Passenger spawn server                                   
nobody 21778 21764 0 10:49 ?  00:00:00 PassengerLoggingAgent 

我肯定在的Ruby/Rails /乘客/管理平臺的專家,但我懷疑的事實,乘客正在運行的nobody而不是redmine可能是問題所在。根據這裏的文檔:http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching,Passenger應該將用戶切換到擁有/config/environment.ru的用戶,只要該用戶可以讀取/寫入日誌並且不是root,那麼正確?從上面可以看出,該文件(實際上是整個應用程序)歸redmine所有,其中包括所有者的rwx日誌和redmineroot因此,我相信我已通過了Passenger to切換爲redmine運行。

三個直接的問題:

  1. 這是我無法下運行客運管理平臺的原因是什麼? ?而**
  2. 爲什麼乘客仍nobody **
  3. 運行在我試圖解決這個問題,我嘗試添加一行:

    PassengerDefaultUser www數據

到我/etc/apache2/mods-enabled/passenger.conf(如上所示),但似乎不起作用。一切的結果都是相同的,沒有這條線。我不希望它能解決這個問題,但我確實希望它顯示爲Passenger在列出流程時運行的用戶。它沒。

其他可能相關的信息:

[email protected]:~$ uname -a 
Linux machine.****.com 2.6.18-028stab092.1 #1 SMP Wed Jul 20 19:47:12 MSD 2011 x86_64 GNU/Linux 
Ubuntu 10.04.4 LTS 

[email protected]:~$ /usr/bin/ruby1.8 --version 
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] 

回答

0

捆綁器的問題。你有什麼特別的理由來使用Ruby 1.8.x?我強烈建議您升級到Ruby 1.9.x,最好是1.9.3。否則,你可能想嘗試更古老的bundler version像0.9.x.另外,您應該將您的Rubygems降級到1.3.7 or something similar

理論上的RubyGems可以降級如下:

sudo gem update --system 1.3.7 

要安裝舊捆綁版本:

sudo gem uninstall bundler 
sudo gem install bundler --version=0.9.1 

有幾次我不得不處理過時的Ruby軟件,最重要的事要做的是不是安裝系統Ruby,但要自己編譯源碼。 (畢竟不是那麼難,Ruby是打包好的。)然後從源代碼安裝合適的Rubygems版本。或者看看RVM,雖然這在開始時會很痛苦。

順便說一句:我也建議使用nginx而不是Apache。安裝文件並不完善,但配置文件要簡單得多。

+1

感謝您的支持! – mkoistinen