2015-05-12 49 views
0

我在DigitalCloud上使用PassengerNginx製作了Ruby on Rails應用程序。一切正常,直到我添加我的自定義域。我只需填寫DigitalCloud上的DNS page,並從域託管提供商定向域到服務器IP。然後我將服務器名稱更改爲新的URL,地址爲/opt/nginx/conf/nginx.conf乘客或Nginx無法使用自定義域名

在這裏的錯誤:

There was an error while trying to write to Gemfile.lock. It is likely that 
you need to allow write permissions for the file at path: 
/var/www/formas_app/Gemfile.lock (Bundler::InstallError) 
    /usr/local/rvm/gems/[email protected]/gems/bundler-1.7.6/lib/bundler/definition.rb:253:in `rescue in lock' 
    /usr/local/rvm/gems/[email protected]/gems/bundler-1.7.6/lib/bundler/definition.rb:238:in `lock' 
    /usr/local/rvm/gems/[email protected]/gems/bundler-1.7.6/lib/bundler/environment.rb:34:in `lock' 
    /usr/local/rvm/gems/[email protected]/gems/bundler-1.7.6/lib/bundler/runtime.rb:44:in `setup' 
    /usr/local/rvm/gems/[email protected]/gems/bundler-1.7.6/lib/bundler.rb:121:in `setup' 
    /usr/local/rvm/gems/[email protected]/gems/bundler-1.7.6/lib/bundler/setup.rb:17:in `<top (required)>' 
    /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
    /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/lib/phusion_passenger/loader_shared_helpers.rb:399:in `activate_gem' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/lib/phusion_passenger/loader_shared_helpers.rb:277:in `block in run_load_path_setup_code' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/lib/phusion_passenger/loader_shared_helpers.rb:404:in `running_bundler' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/lib/phusion_passenger/loader_shared_helpers.rb:276:in `run_load_path_setup_code' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/helper-scripts/rack-preloader.rb:99:in `preload_app' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/helper-scripts/rack-preloader.rb:153:in `<module:App>' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>' 
    /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/helper-scripts/rack-preloader.rb:28:in `<main>' 

這是我/opt/nginx/conf/nginx.conf文件:

worker_processes 1; 

events { 
    worker_connections 1024; 
} 

http { 
    passenger_friendly_error_pages on; 
    passenger_root /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7; 
    passenger_ruby /usr/local/rvm/gems/ruby-2.1.5/wrappers/ruby; 

    include  mime.types; 
    default_type application/octet-stream; 

    sendfile  on; 
    keepalive_timeout 65; 

    server { 
     listen  80; 
     server_name mydomain.com; 
     passenger_enabled on; 
     root /var/www/my_app/public; 
    } 
} 

想不通是什麼問題。 謝謝反正!

編輯我的問題: 當我運行bundle install客運錯誤頁面去了,但現在我有一個顯示了標準軌錯誤頁面。我猜它向前邁進了一步,但我仍然需要幫助:D

+0

我認爲它的文件夾和文件權限問題,所以請給予適當的權限,並嘗試。 –

回答

0

您需要在您的/var/www/formas_app目錄中運行bundle install。看起來用於與乘客運行應用程序的用戶沒有權限這樣做。

我建議您查看Capistrano以獲得更簡化的部署,每次部署時都會爲您處理此問題。

+0

運行'bundle install' Passenger錯誤頁面失敗,但是現在我有標準rails錯誤頁面。你怎麼看? – DanielsV

+0

你看到什麼錯誤?你嘗試在谷歌搜索消息?如果你看不到錯誤信息,你應該嘗試通過你的Rails應用程序日誌進行挖掘。如果沒有什麼可疑的話,試試nginx日誌。 – Dorian