Monday, April 8, 2013

Configuring Phusion Passenger on Mac OS X Lion

Phusion Passenger can manage your Ruby on Rails Applications to running on Apache Web server, I have installed on my MBP, check it out.

Firstly, intall the "passenger" gem
> sudo gem install passenger
> sudo passenger-install-apache2-module 

you would see the wizard installation, follow the instructions step by step :)
now, passenger is installed.

Copy these lines.

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_pa$
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.19
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Then, adding a chuck of code before to "httpd.conf"
sudo nano /etc/apache2/httpd.conf

Now, edit Vhost
sudo nano /etc/apache2/httpd.conf

find and uncomment this line code:
"include /private/etc/apache2/extra/httpd-vhosts.conf"

Next, we need to adding new local domain
sudo nano /etc/hosts
Add new your domain.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
127.0.0.1       projectname.local
Edit your Vhost file
sudo nano /etc/apache2/extra/httpd-vhosts.conf
Add codes below:

< VirtualHost *:80>
ServerName projectname.local
DocumentRoot "/Users/oya_andriani/Documents/My Labs/depot/public"
RailsEnv development
RailsBaseURI /
 < Directory "/Users/oya_andriani/Documents/My Labs/depot/public/">
        AllowOverride None
        Order allow,deny
        Allow from all
 < /Directory>
< /VirtualHost>

Finaly, restart your apache
sudo apachectl retart
It's done, access your local domain with your browser.

No comments:

Post a Comment