passenger & sinatra

# root@pentaho# gem install passenger
root@pentaho# passenger-install-apache2-module                             [~]
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.4.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

--------------------------------------------

Checking for required software...

* GNU C++ compiler... found at /usr/bin/g++
* Ruby development headers... found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /usr/bin/rake
* Apache 2... found at /usr/sbin/apache2
* Apache 2 development headers... not found
* Apache Portable Runtime (APR) development headers... not found
* Apache Portable Runtime Utility (APU) development headers... not found

Some required software is not installed.
But don't worry, this installer will tell you how to install them.

Press Enter to continue, or Ctrl-C to abort.
                                                                                      • -
Installation instructions for required software

* To install Apache 2 development headers:
Please run apt-get install apache2-prefork-dev as root.

* To install Apache Portable Runtime (APR) development headers:
Please run apt-get install libapr1-dev as root.

* To install Apache Portable Runtime Utility (APU) development headers:
Please run apt-get install libaprutil1-dev as root.

If the aforementioned instructions didn't solve your problem, then please take
a look at the Users Guide:

/var/lib/gems/1.8/gems/passenger-2.2.4/doc/Users guide Apache.html
root@pentaho# apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev

:
cc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/1.8/x86_64-linux -I.   -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   -c native_support.c
cc -shared -o native_support.so native_support.o -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic    -lruby1.8

--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific

configuration!

Press ENTER to continue.

--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host
to your Apache configuration file, and set its DocumentRoot to

/somewhere/public, like this:

<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
</VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:

/var/lib/gems/1.8/gems/passenger-2.2.4/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)

http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
hao@pentaho% ls                               [~/public_html/sinatra/rcockpit]
config/  index.rb*  public/  views/
hao@pentaho% vi config.ru                     [~/public_html/sinatra/rcockpit]
hao@pentaho% cat config.ru                    [~/public_html/sinatra/rcockpit]
require 'index' # Sinatra application
run Sinatra::Application
hao@pentaho% mkdir tmp                        [~/public_html/sinatra/rcockpit]
root@pentaho# ln -s /home/hao/public_html/sinatra/rcockpit/public ./rcockpit
root@pentaho# cd /etc/apache2/sites-available   [/etc/apache2/sites-available]
root@pentaho# vi rcockpit                       [/etc/apache2/sites-available]
root@pentaho# cat rcockpit                      [/etc/apache2/sites-available]
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8

RackBaseURI /rcockpit
root@pentaho# a2ensite rcockpit                 [/etc/apache2/sites-available]