- Create folder
~/yourapp
- Create folder
~/yourapp/tmp
- Create file
~/yourapp/config.ru
with the following content:
# encoding: UTF-8
require './appmain'
run Sinatra::Application
- Create file
appmain.rb
with the following content:
# appmain.rb
require 'sinatra'
get '/' do
'Hello world!'
end
I installed gems sinatra
and rubygems
(maybe the latter is not needed).
This can be done either using Terminal (gem install sinatra
) or using cPanel.
In the ~/public_html
folder create/modify .htaccess
with the following content:
SetEnv GEM_HOME /home/.../ruby/gems
PassengerAppRoot /home/.../yourapp
where /home/.../ruby/gems
is the path to your local folder where the gems got installed and /home/.../yourapp
is a full path to ~/yourapp
.
Sometimes after updating config.ru
Passenger has to be restarted (otherwise the application does not get updated). To do this simply go to ~/yourapp
and
touch tmp/restart.txt
I've created a file restart.sh
with the content
#!/bin/sh
touch tmp/restart.txt
and run chmod a+x restart.sh
so that I can simply execute ./restart.sh
to restart Passenger.
You rock! This really helped me. Thank you!