簡體   English   中英

Bundler報告缺少的寶石; Rails對Apache不可見

[英]Bundler reporting gems missing that aren't; Rails is invisible to Apache

背景/設置

我已經在RedHat 6系統上安裝了Ruby 1.9.3-p0。

我運行passenger-install-apache2-module並將配置代碼的片段插入到我的httpd.conf中:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11
PassengerRuby /usr/local/bin/ruby

我添加了虛擬主機配置...

<VirtualHost *:80>

    ServerName contracker-rails3-test.mysite.com
    ServerAlias contracker-rails3-test

    DocumentRoot /opt/deployed_rails_apps/contracker/current/public

    <Directory /opt/deployed_rails_apps/contracker/current/public>
        AllowOverride all
        Options -MultiViews
    </Directory>

    RailsEnv production

</VirtualHost>

我使用Capistrano部署了我的應用程序。

然后(最終)能夠讓Bundler安裝該應用程序的gem。 因此,現在Bundler報告所有寶石都已安裝,並且一切正常。

主要問題:

當我在瀏覽器中訪問應用程序的URL時,我僅獲得Apache的默認歡迎頁面。 該應用程序不會產生任何日志記錄輸出(甚至不會創建日志文件),因此似乎根本無法訪問Rails。

我檢查過的東西

我通過將index.html文件放在配置的位置來驗證vhost配置是否正確。 當我嘗試使用URL時,該文件會顯示出來,因此vhost很好。

我檢查了生產數據庫是否存在並可用。

該應用程序可以在我的OS X開發筆記本電腦上正常運行。

我在已部署的應用程序的根目錄中嘗試了此實驗...

[em@web3 current]$ which ruby
/usr/local/bin/ruby

[em@web3 current]$ which gem
/usr/local/bin/gem

[em@web3 current]$ gem list -l

*** LOCAL GEMS ***

actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.1)

[...lots of gems...]

rails (3.2.1)

[...lots of gems...]

[em@web3 current]$ which rails
/usr/bin/which: no rails in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/emicha/bin)

為什么找不到Rails?

還嘗試了這個...

[em@web3 current]$ rails console
-bash: rails: command not found

捆綁器產生奇怪的,無意義的錯誤

我懷疑這可能與Bundler有關,因為我無法運行任何Rake任務...

[em@web3 current]$ bundle exec rake -T
Could not find journey-1.0.2 in any of the sources

還嘗試了...

[em@web3 current]$ rake -T
Could not find journey-1.0.2 in any of the sources
Run `bundle install` to install missing gems.

為什么嘗試運行Rake任務會導致Bundler查找名為“旅程”的寶石或任何寶石?

所以...

是否有人對此有任何想法?

還有什么我可以檢查的嗎?

SELinux再次。

這阻止了Apache加載旅客/鐵路。 我為整個系統將其關閉,現在該應用程序可以訪問了。 我必須弄清楚如何保留它,但要允許它使用Rails。

但是,無論有沒有SELinux,Bundler仍然表現出相同的行為-實際安裝的“找不到xyz gem”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM