Ruby on Rails, nginx, passenger on production server (cannot load such file -- rubygems/path_support)
I had a similar problem, though I had rvm and ruby installed only for one user. For me, the solution was to check that the application files were owned by the same user for which ruby was installed.
http://www.modrails.com/documentation/Users%20guide%20Nginx.html#user_switching
running a Rails app on a fresh installation of Nginx/Passenger causes error no such file to load -- bundler/setup (LoadError)
After trying various things, I gave up on having nginx installed from Debian packages. I removed it, and also removed my rubies and RVM, then reinstalled everything, following these directions. The article advises how to install nginx using the passenger-install-nginx-module
command that comes with the passenger gem. It checks all dependencies, and if it can proceed, downloads and compiles nginx. By default, it's installed in /opt/nginx/
.
This did not work immediately. I also had to create an nginx startup script; instructions here. Furthermore, I had to edit the /opt/nginx/conf/nginx.conf
file to add a reference to my application, and also had to comment out the location /
block. After all this, and commanding sudo service nginx restart
, the site is up.
cannot load such file -- bundler/setup (LoadError) || deploy on Ubuntu 12.04 x32
You sure have some PATH issues. Inside the /etc/nginx/nginx.conf
, for passenger, you should be pointing to the ruby version where bundler is installed.
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/thomas/.rvm/wrappers/default/ruby;
You can check this with the command
$ which ruby
The output of that command should be the one you should enter for passenger_ruby
If you haven't installed bundler yet go ahead and run gem install bundler
Also make sure that you are setting the environment variable in your server block:
server {
listen 80 default;
server_name blog.wall2flower.me;
root /var/www/blog/current/public;
passenger_enabled on;
}
cannot load such file -- bundler/setup (LoadError)
It could be that there was a previous Ruby env installed on your system prior to your installation of 2.0? This might have had an existing GEM_PATH that lead to the /1.8 directory which the installation of version 2.0 simply kept.
The problem you where likely having, then, was that Passenger/Apache was looking in the /2.0 directory when in fact the gems were in the /1.8 directory. Your explicitly telling apache to use the /1.8 directory thus makes sense to fix the problem.
SetEnv GEM_HOME /usr/lib/ruby/gems/1.8
You might also try using the Ruby Version Manager to handle multiple Ruby envs.
Some things I found in Google:
- New to Ruby and am having trouble with LOAD_PATH
- http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices/
- http://guides.rubygems.org/faqs/
Production does'nt work ( Rails 5 , Passenger , Nginx )
So, it turned out that the problem was due to incorrect file permissions for the user.
Nginx was being run as www-data user which didn't have permissions to read files of the app-directory.
That is why booting of app-server was failing.
sudo chown -R www-data:www-data /home/rails/myapp
After using above command, passenger will be able to read the files of app-directory and will successfully start.
Related Topics
Return Values Were Not Extracted in Ruby
How to Ignore File Types in a Web Crawler
Rails: Organizing Models in Subfolders Having Warning: Toplevel Constant a Referenced by B::A
Assign to an Array and Replace Emerged Nil Values
How to Get the Nth Element of an Enumerable in Ruby
Why Can't I Change the Value of Self
Ruby Symbol#To_Proc Leaks References in 1.9.2-P180
Pass Arguments by Reference to a Block with the Splat Operator
Reading Parameters on Sinatra Post
Ruby: Length of a Line of a File in Bytes
How to Access Text Field in an Iframe
Uri::Invalidurierror: Bad Uri(Is Not Uri) Testing Rails Controllers
What Does "String Literal in Condition" Mean
Ruby on Rails Workflow Engine (Like Ibm Workflow)
How to Test Order-Conscious Equality of Hashes
How to Pass the JavaScript Value as JSON Object to the Controller in Ruby on Rails