Finally figured out why the CGI scripts were failing. It was because of the hashbang and RVM. Did a fresh install of ruby from source and hadlinked /usr/bin/ruby -> /usr/local/bin/ruby, all problems solved. #!usr/bin/ruby works now :)