我有一个带有Rails 5.1,Phusion_Passenger和Nginx的服务器。
当我使用Phusion_Passenger启动服务器时,一切都很好:
=============== Phusion Passenger Standalone web server started ===============
PID file: /project/tmp/pids/passenger.3000.pid
Log file: /project/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
===============================================================================
[ N 2017-09-26 15:13:06.4195 8753/T5 age/Cor/SecurityUpdateChecker.h:374 ]: Security update check: no update found (next check in 24 hours)
当我尝试使用Nginx作为叠加层启动并访问同一个实例时,出现以下错误:
App 8129 stdout:
App 8129 stdout:
[ E 2017-09-26 15:06:26.4848 1774/T1l age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /project: An error occurred while starting up the preloader.
Error ID: e18b79ab
Error details saved to: /tmp/passenger-error-YkowRo.html
Message from application: Cannot load `Rails.application.database_configuration`:
undefined method `[]' for nil:NilClass (NoMethodError)
(erb):13:in `<main>'
当您使用Nginx加载rails应用程序时,它似乎无法访问&#34; Rails&#34;对象
答案 0 :(得分:0)
Passenger没有在passenger.conf中设置默认环境。添加了此变量并修复了问题。
passenger_app_env development;