Running mod_rails on Leopard (OSX 10.5) 2

Posted by Daniel Wanja Sat, 14 Jun 2008 22:40:29 GMT

From the command line:

gem install passenger
sudo passenger-install-apache2-module

The Apache 2 module was successfully installed.

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

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so
RailsSpawnServer /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server
RailsRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Hey…where is the configuration. Google told me to read this blog entry: http://www.fuzzylizard.com/archives/2008/05/29/947/

So copy these three lines and add them to the end of this file: /etc/apache2/httpd.conf

$ sudo mate /etc/apache2/httpd.conf

Start and stop Apache go the to the System Preferences|Sharing and select the Web Sharing service:

20080616_syspref.jpg

Then the install script gives you the following instructions.

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
   </VirtualHost>

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

  /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/doc/Users guide.html

Enjoy Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/ 

Now where is “my” apache configuration file? And more important where is yours? On the command line do

$ ls /etc/apache2/users/

And I see daniel.conf, so let’s edit that one. I am developing one Rails app in this folder: /Users/daniel/SvnProjects/for/stockportfolio/rails. So let’s define this application in that conf file:

$ sudo mate /etc/apache2/users/daniel.conf

<Directory "/Users/daniel/SvnProjects/for/stockportfolio/rails/">
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
   ServerName dev.stockportfolio.com
   DocumentRoot /Users/daniel/SvnProjects/for/stockportfolio/rails/public
</VirtualHost>

Note the /public at the end of the folder in the DocumentRoot. Now I am adding dev.stockportfolio.com in my /etc/hosts file. So just add the following line

127.0.0.1  dev.stockportfolio.com

Now go back to the system preference sharing tab and restart the web service. Now you have your application running … in production mode. Just point your browser to dev.stockportfolio.com.

Enjoy Daniel!

Comments

Leave a response

  1. Dr Nic Sun, 15 Jun 2008 23:15:21 GMT

    When i run the installer command on Leopard I get the following error:

    ## In ext/boost/src:
    g++ -g -DPASSENGER_DEBUG -fPIC -I../.. -D_REENTRANT -DNDEBUG -arch ppc7400 -arch ppc64 -arch i386 -arch x86_64 -c *.cpp pthread/*.cpp
    g++-4.0: installation problem, cannot exec '': No such file or directory
    
    lipo: can't figure out the architecture type of: /var/tmp//cc8yEvUx.out
    rake aborted!
    Command failed with status (255): [g++ -g -DPASSENGER_DEBUG -fPIC -I../.. -D_...]
    /Library/Ruby/Gems/1.8/gems/passenger-1.9.0/rakefile:97
    (See full trace by running task with --trace)

    Anyone seen + fixed this?

Comments