Add multiple virtual host along with Passenger

I was having few projects on my MAC and was really bugged up with maintaining the port numbers and other stuffs, a real cumbersome.

After, Jacek’s thought on this, I had set up the following:

Install the gem:

sudo gem install ghost

after that add a virtual host

sudo ghost add paddy.local (a choice of your virtual host)

Install the Passenger gem:

sudo gem install passenger
sudo passenger-install-apache2-module

After installing the apache module for passenger, you may have add the following lines (after installation it will tell based on your own enviroment)

(in your httpd.conf)

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.8/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.8
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Also you may have to enable your virtual host too …by default, it may be disabled(commented) and you have to enable(uncomment) it

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

Next, you have to add the vitual host for your rails app.

(httpd-vhosts.conf)


ServerName www.yourhost.com
DocumentRoot /somewhere/public    # <– be sure to point to ‘public’!

AllowOverride all              # <– relax Apache security settings
Options -MultiViews            # <– MultiViews must be turned off

And you have to restart your apache server and start your respective rails app.

Happy Developing with Virtual Host