My VPS is running Ubuntu 12.04. I installed Nginx and Passenger on it, following these and these instructions , and in accordance with the instructions, I added the following lines to the http block of the /etc/nginx/nginx.conf file:
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini; passenger_ruby /usr/bin/ruby;
and the following block (where I replaced the actual domain name with www.example.com ):
server { listen 80; server_name www.example.com; root /srv/rails/myapp/public; passenger_enabled on; }
The Rails application is located in the /srv/rails/myapp/ , which is also the directory for the Git project. The directory and all its contents are owned by the rails user. I made the directory writable in the world and, as the rails user, ran the following commands in it:
git pull gem install bundler bundle install rake db:migrate RAILS_ENV=production bundle exec rake assets:precompile
After that, the application starts in development mode: when I rails s command and open http://www.example.com//000 , the application works fine.
However, after doing all of the above and the sudo service nginx restart command, opening http://www.example.com gives the Passenger Error Screen, which says:
no such file to load -- bundler/setup (LoadError) /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:245:in `run_load_path_setup_code' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:348:in `running_bundler' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:243:in `run_load_path_setup_code' /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app' /usr/share/passenger/helper-scripts/rack-preloader.rb:158
There's a lot of debugging output below this, and I'm not sure which one is useful, but here is an excerpt:
Application root /srv/rails/myapp Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV and PASSENGER_ENV) production Ruby interpreter command /usr/bin/ruby User and groups uid=1001(rails) gid=1002(rails) groups=1002(rails) Environment variables SHELL = /bin/bash PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.XXXX2fPMPM USER = rails PWD = /srv/rails/myapp SHLVL = 0 HOME = /home/rails LOGNAME = rails SERVER_SOFTWARE = nginx/1.4.6 IN_PASSENGER = 1 PYTHONUNBUFFERED = 1 NODE_PATH = /usr/share/passenger/node RAILS_ENV = production RACK_ENV = production WSGI_ENV = production NODE_ENV = production PASSENGER_APP_ENV = production SERVER_PROTOCOL = HTTP/1.1 SCGI = 1 DOCUMENT_ROOT = /srv/rails/myapp/public QUERY_STRING = SERVER_NAME = www.example.com REMOTE_PORT = 49316 REMOTE_ADDR = [redacted] SERVER_PORT = 80 REQUEST_METHOD = GET SERVER_ADDR = [redacted] REQUEST_URI = / ... General Ruby interpreter information RUBY_VERSION = 1.8.7 RUBY_PLATFORM = x86_64-linux RUBY_ENGINE = nil RubyGems version = 1.8.15
The application uses Ruby v2.0.0p353, while Passenger seems to use v1.8.7; I am not sure if this is due to this problem. (The Ruby used by the application lives in /home/rails/.rvm/rubies/ruby-2.0.0-p353/ .)
I was looking for other issues where Passengers will display this error, but nothing I've tried so far fixes the problem.