-1

I have a very simple CGI server set up with lighttpd's mod_cgi and I have a multi-user install of RVM. How can I set up lighttpd to use RVM's ruby and its default gems?

I tried adding the lighttpd user to the rvm group, but that seems useless since rvm use ... only works from a login shell (and you can't log in as lighttpd).

I also tried just setting

".rb"  => "/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby"

in /etc/lighttpd/conf.d/cgi.conf. Then Ruby scripts work with CGI, but I still can't require any gems.

Max
  • 21,123
  • 5
  • 49
  • 71

1 Answers1

0

The solution is to use RVM generated wrappers, which bundle up the whole environment specifically for such a purpose. The instructions for using RVM with cron are very helpful since lighttpd CGI runs in a similarly barren no-login environment.

In my case, it was as simple as changing cgi.assign in cgi.conf to

".rb" => "/usr/local/rvm/wrappers/ruby-2.1.2/ruby"
Max
  • 21,123
  • 5
  • 49
  • 71