将RoR部署到AWS Beanstalk时出现Nginx错误

时间:2016-12-16 13:52:17

标签: nginx deployment elastic-beanstalk ruby-on-rails-5

我正在尝试将Ruby on Rails API部署到AWS Elastic Beanstalk而没有任何运气。我可以成功部署,但我只会遇到错误,因为生产环境并不是db:seed。但突然每次我想部署我都会在日志上出现以下错误

-------------------------------------
/var/app/support/logs/passenger.log
-------------------------------------
[ 2016-12-16 13:22:39.2849 5408/7f442ea10780 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
2016/12/16 13:22:40 [error] 5427#0: *3 "/var/app/current/public/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"
2016/12/16 13:22:40 [error] 5427#0: *3 testing "/var/app/current/public" existence failed (2: No such file or directory) while logging request, client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"


-------------------------------------
/var/log/eb-activity.log
-------------------------------------
  + service passenger restart
   --> Downloading a Phusion Passenger agent binary for your platform
  ---------------------------------------
  No precompiled Nginx engine could be downloaded. Compiling it from source instead.
  --------------------------------------------

  Your system does not have a lot of virtual memory

  Installing...
  Downloading Nginx 1.8.1 source code...
  Extracting tarball...
  Compiling support libraries (step 1 of 2)...
  Compiling Nginx engine (step 2 of 2)...

  ./configure: error: invalid option "--with-http_v2_module"
  *** ERROR: command failed: cd /tmp/passenger-install.158a2iu/nginx-1.8.1 && env PASSENGER_INCLUDEDIR=/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.1.0/src PASSENGER_LIBS=/tmp/passenger-install.158a2iu/common/libpassenger_common/Logging.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Exceptions.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/SystemTime.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/StrIntUtils.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/StrIntUtilsNoStrictAliasing.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/IOUtils.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/WatchdogLauncher.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/AppTypes.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/CachedFileStat.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/UnionStationFilterSupport.o\ /tmp/passenger-install.158a2iu/common/libboost_oxt.a /bin/bash ./configure --prefix=/tmp --with-cc-opt=-Wno-error --without-http_fastcgi_module --without-http_scgi_module --without-http_uwsgi_module --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --add-module=/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.1.0/src/nginx_module

我甚至git revert提交,以便回到成功部署的版本,但得到相同的错误!

PD: 我必须做的另一件事(在第一次工作之前)将EC2实例的Root卷大小设置为16 GiB,因为我会得到nokogiri gem无法由budler安装的错误,并且它实际上已修复该

1 个答案:

答案 0 :(得分:1)

您看到的错误几乎可能是因为您在Gemfile中列出了Passenger Gem。如果需要,将其删除或放入development部分可以解决问题。 {E {1}}预先安装在AWS ElasticBeanstalk Ruby Stack上。