Hi,
We have a legacy Rack app. We had to migrate the server (hardware trouble) and now we can't get it off the ground. No one of us is a Ruby developer but we have a good knowledge of Linux, Apache, PHP etc.
The app seems to be using the CGI handler. We are running on top of Apache using Passenger. The server is CentOS release 6.3, Apache/2.2.15, Phusion Passenger version 3.0.19, ruby 1.8.7, `gem list --local` shows rack (1.4.1, 1.1.0).
The main page (
config.ru - see below) displays fine, but all other files (from htdocs subdirectory) are served as source code or offered as a download.
The directory structure is very simple:
/var/www/domain
Here is the content of faq.rb. All of our rb files look similar.
#!/usr/bin/ruby
require 'rubygems'
require 'rack'
APP_ROOT = '/var/www/op.pharmacogenomics.ca/app'
TEMPLATE_ROOT = File.join(APP_ROOT, 'views')
require "#{APP_ROOT}/models/optimus"
class OPIndex
def call(env)
@CONTENT = {}
input = File.open(File.join(TEMPLATE_ROOT, 'optimus', 'faq.html.erb')).read
@CONTENT['main'] = ERB.new(input, nil, '<>').result(binding)
template = File.open(File.join(TEMPLATE_ROOT, 'layouts', 'application.html.erb')).read
html = ERB.new(template, nil, '<>').result(binding)
[
200,
{ "Content-Type" => "text/html" },
html
]
end
end
app = Rack::Builder.new do
use Rack::ShowExceptions
run OPIndex.new
end
Rack::Handler::CGI.run(app)
Apache configuration:
LoadModule passenger_module /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.19
PassengerRuby /usr/bin/ruby