让我展示我的Gemfile。
source 'https://rubygems.org'
ruby "2.4.1"
gem 'rails', '5.1.4'
gem 'puma'
gem 'pg'
gem "bower-rails", "~> 0.11.0"
gem 'd3_rails'
# Auth
gem 'devise'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-google-oauth2'
# Front-end
gem 'react-rails'
gem 'bootstrap-sass'
gem 'sass-rails'
gem 'font-awesome-sass'
gem 'uglifier'
gem 'autoprefixer-rails'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'turbolinks'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jbuilder'
gem 'friendly_id'
# Image upload
gem 'carrierwave'
gem 'mini_magick'
gem 'fog'
gem 'net-ssh'
gem 'sdoc', group: :doc
# Load will_paginate before elasticsearch gems.
gem 'will_paginate'
# Elasticsearch
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
# Background Job
gem 'sidekiq'
gem 'sinatra', require: false
gem 'slim'
# gem 'sidetiq', '~> 0.7.0'
gem 'nokogiri'
# Caching
gem 'dalli'
gem 'bundler-audit'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
gem 'byebug'
gem 'rspec-rails', '~> 3.6'
gem 'poltergeist'
gem 'awesome_print'
gem 'pry-rails'
end
group :development do
gem 'rails_best_practices'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console'
gem 'spring'
gem 'guard-rspec', require: false
gem 'spring-commands-rspec'
gem 'rack-mini-profiler', require: false
gem 'annotate'
gem 'bullet'
end
group :test do
gem 'database_cleaner'
gem 'capybara'
gem 'factory_girl_rails'
gem 'faker'
gem 'launchy'
gem 'selenium-webdriver'
end
group :production do
gem 'rails_12factor'
gem 'bonsai-elasticsearch-rails'
end
安装gems时没有错误,并且完全配置了Passenger和Apache2 Server。这意味着当我部署rails应用程序时,没有错误。
我将显示apache error.log
N 2017-09-21 12:26:00.3272 883/T5 Ser/Server.h:531 ]: [UstRouterApiServer] Shutdown finished
[ N 2017-09-21 12:26:00.3274 883/T3 Ser/Server.h:531 ]: [UstRouter] Shutdown finished
[ N 2017-09-21 12:26:00.3275 883/T1 age/Ust/UstRouterMain.cpp:531 ]: Passenger UstRouter shutdown finished
[ N 2017-09-21 12:26:00.3352 2202/T1 age/Wat/WatchdogMain.cpp:1283 ]: Starting Passenger watchdog...
[ N 2017-09-21 12:26:00.3496 2206/T1 age/Cor/CoreMain.cpp:1083 ]: Starting Passenger core...
[ N 2017-09-21 12:26:00.3497 2206/T1 age/Cor/CoreMain.cpp:248 ]: Passenger core running in multi-application mode.
[ N 2017-09-21 12:26:00.3574 2206/T1 age/Cor/CoreMain.cpp:830 ]: Passenger core online, PID 2206
[ N 2017-09-21 12:26:00.3742 2212/T1 age/Ust/UstRouterMain.cpp:537 ]: Starting Passenger UstRouter...
[ N 2017-09-21 12:26:00.3750 2212/T1 age/Ust/UstRouterMain.cpp:350 ]: Passenger UstRouter online, PID 2212
[Thu Sep 21 12:26:00.376239 2017] [mpm_event:notice] [pid 18263:tid 140438528898944] AH00489: Apache/2.4.18 (Ubuntu) Phusion_Passenger/5.1.8 configured -- resuming normal operations
[Thu Sep 21 12:26:00.376261 2017] [core:notice] [pid 18263:tid 140438528898944] AH00094: Command line: '/usr/sbin/apache2'
[ N 2017-09-21 12:26:00.5539 877/T1 age/Cor/CoreMain.cpp:1068 ]: Passenger core shutdown finished
[ N 2017-09-21 12:26:02.8255 2206/T8 age/Cor/SecurityUpdateChecker.h:374 ]: Security update check: no update found (next check in 24 hours)
App 2289 stdout:
App 2289 stdout: BONSAI_URL not present, proceeding with Elasticsearch defaults.
App 2430 stdout:
所以我测试了示例rails项目,因为我无法理解为什么这会超出我在AWS上的项目。因此它可以正常工作。
我将展示简单项目的conf文件。
<VirtualHost *:80>
ServerName ec2-34-229-186-158.compute-1.amazonaws.com # Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/simple/public
PassengerRuby /usr/local/rvm/gems/ruby-2.4.1/wrappers/ruby # Relax Apache security settings
<Directory /var/www/simple/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
</VirtualHost>
只有部署的rails应用程序无效。
有人帮助我吗? :)
答案 0 :(得分:0)
如果基本应用有效且您的实际应用没有表明问题出在您的实际应用中。您的应用程序启动时间超过90秒吗?或者它取决于服务器环境中可能缺少的某些配置?
你有美洲狮&#39;宝石文件中的宝石,但用Passenger标记了问题。你应该只使用其中一个。