<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>The Napkin ~ A Blog By Highgroove Studios comments on Development with Rails + Passenger (AKA mod_rails) on Mac</title>
    <link>http://napkin.highgroove.com/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>The Napkin ~ A Blog By Highgroove Studios comments</description>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by visa secured</title>
      <description>&lt;p&gt;Nice Site!
http://google.com&lt;/p&gt;</description>
      <pubDate>Wed,  4 Jun 2008 18:03:00 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1025</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1025</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Thomas</title>
      <description>&lt;p&gt;Hongli Lai: Now there´s someone who should know ;) Great show on Railsconf from what I can see in the summaries on the web.&lt;/p&gt;


	&lt;p&gt;Next (and last) question is: How do I best give user www access to my custom hosting directories ? And why don´t all you others have this issue too ? (or is it just that I am a unix noob and it´s implicit in the recipe?).&lt;/p&gt;


	&lt;p&gt;Greetings from Norway anyway. Great tutorial, great apache module, and great help.&lt;/p&gt;</description>
      <pubDate>Tue,  3 Jun 2008 17:30:45 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1023</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1023</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Hongli Lai</title>
      <description>&lt;p&gt;&amp;#8220;Do I have to explicitedly give permission for apache2 (www) to read/execute the directories I want to host?&amp;#8221;&lt;/p&gt;


	&lt;p&gt;Yes.&lt;/p&gt;</description>
      <pubDate>Tue,  3 Jun 2008 13:07:29 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1022</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1022</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Tekin</title>
      <description>&lt;p&gt;I&amp;#8217;m far from an Apache expert but it does seem like a permissions issue to me. Have you tried changing the permissions? Maybe the access/error logs will have a clue?&lt;/p&gt;</description>
      <pubDate>Mon,  2 Jun 2008 03:50:00 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1021</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1021</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Thomas</title>
      <description>&lt;p&gt;Tekin: No I am not. But I can&amp;#8217;t for all that&amp;#8217;s holy get passed this &amp;#8220;Forbidden&amp;#8221; thing. It&amp;#8217;s been 2 days!&lt;/p&gt;


	&lt;p&gt;Do I have to explicitedly give permission for apache2 (www) to read/execute the directories I want to host?&lt;/p&gt;</description>
      <pubDate>Sun,  1 Jun 2008 13:28:12 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1020</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1020</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Tekin</title>
      <description>&lt;p&gt;Thomas: Are you running FileVault? If so, this might be causing permission issues -&lt;/p&gt;


	&lt;p&gt;http://blog.phpguy.org/2008/04/26/apple-filevault-and-apache-http-server&lt;/p&gt;</description>
      <pubDate>Sun,  1 Jun 2008 13:11:37 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1019</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1019</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Thomas</title>
      <description>&lt;p&gt;I keep getting Forbidden to access / on this server after following this recipe&amp;#8230;  any ideas ?&lt;/p&gt;</description>
      <pubDate>Thu, 29 May 2008 17:19:05 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1018</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1018</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Ivan</title>
      <description>&lt;p&gt;Thank you very much Grant, I was missing the line &amp;#8220;NameVirtualHost *:80&amp;#8221; in the conf file I had setup for my virtual hosts. Everything works like a charm now.&lt;/p&gt;</description>
      <pubDate>Wed, 28 May 2008 11:56:12 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1016</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1016</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Grant Neufeld</title>
      <description>&lt;p&gt;(sorry, my dash-greater-than arrows were turned into strike-though notation by the comment formatter)&lt;/p&gt;</description>
      <pubDate>Wed, 28 May 2008 11:22:53 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1015</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1015</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Grant Neufeld</title>
      <description>&lt;p&gt;@Ivan: Is the following line uncommented in /etc/apache2/extra/httpd-vhosts.conf:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;NameVirtualHost *:80&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and this line uncommented in /etc/apache2/httpd.conf:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;Include /private/etc/apache2/extra/httpd-vhosts.conf&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Also, if you’re using the built-in firewall (System Preferences &lt;del&gt;&amp;gt; Security &lt;/del&gt;&amp;gt; Firewall), did you turn on the webserver (“Web Sharing”) in System Preferences -&amp;gt; Sharing so that it will open up port 80 in the firewall?&lt;/p&gt;</description>
      <pubDate>Wed, 28 May 2008 11:21:21 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1014</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1014</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac": comment by Ivan</title>
      <description>&lt;p&gt;I followed your instructions and it works alright for one app, however I can&amp;#8217;t get it to work for two different apps. My two hosts configured in /etc/hosts are displaying the same virtual host.
Any idea what might be the problem ?&lt;/p&gt;</description>
      <pubDate>Wed, 28 May 2008 09:20:25 EST</pubDate>
      <guid>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1013</guid>
      <link>http://napkin.highgroove.com/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac#comment-1013</link>
    </item>
    <item>
      <title>"Development with Rails + Passenger (AKA mod_rails) on Mac" by andre</title>
      <description>&lt;h2&gt;Passenger, AKA mod_rails&lt;/h2&gt;

&lt;p&gt;There are a number of posts (&lt;a href="http://www.fngtps.com/2008/04/using-passenger-on-osx-for-rails-development"&gt;one&lt;/a&gt;,  &lt;a href="http://benr75.com/articles/2008/04/12/setup-mod_rails-phusion-mac-os-x-leopard"&gt;two&lt;/a&gt;) out there on getting Phusion's &lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt; up and running on OSX (Leopard). I decided to give it a go, and was pleased to discover several things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Despite reports to the contrary, Passenger installed just fine with Leopard's built-in Apache (I'm running Apache 2.2.8).&lt;/li&gt;
&lt;li&gt;Setup is very easy, as advertised.&lt;/li&gt;
&lt;li&gt;My default doc root(~/Sites) is works exactly as it did before. I do some HTML and PHP work there, so it was key that it continue to work properly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Since the install process itself is quite easy, I wanted to offer a few tips for utilizing Passenger in a typical dev environment -- i.e., what you need after you get your first Passenger-powered Rails app up and running.&lt;/p&gt;

&lt;h2&gt;Your Brain on Passenger&lt;/h2&gt;

&lt;p&gt;As you know, &lt;code&gt;script/server&lt;/code&gt; starts your Rails app on a specific port. If you bounce around between a number of applications at any one time, you're probably used to either starting them on different ports, or control-c'ing your current mongrel, cd'ing to another app's directory, and script/server'ing again. This familiar pattern changes when you're running passenger. All your apps are available at any one time, as long as you have your vhosts configured.&lt;/p&gt;

&lt;p&gt;If you're like me, you usually hit your currently running Rails app on http://localhost:3000. That also changes when you're running Passenger. Instead, you'll hit a unique URL for each app, which you've configured in /etc/hosts to just go to 127.0.0.1&lt;/p&gt;

&lt;h2&gt;Setting up a new app&lt;/h2&gt;

&lt;p&gt;I set up a lot of Rails apps in my dev environment. With Passenger, in exchange for the on-demand convenience of accessing any of your apps any time, there are a few additional setup steps to take whenever you introduce a new app into your dev environment.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create your rails project as usual&lt;/li&gt;
&lt;li&gt;add a new vhost. I configure mine in &lt;code&gt;/private/etc/apache2/extra/http-vhosts.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;add the host in /etc/hosts&lt;/li&gt;
&lt;li&gt;restart apache: sudo apachectl restart&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's a &lt;strong&gt;vhosts&lt;/strong&gt; example with two apps I'm running locally. You can set up as many apps as you want this way:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;lt;VirtualHost *:80&amp;gt;
    DocumentRoot "/Users/andre/projects/rails/hotspotr/public"
    ServerName dev.hotspotr.com
    ErrorLog "/Users/andre/projects/rails/hotspotr/log/error.log"
  &amp;lt;/VirtualHost&amp;gt;

  &amp;lt;VirtualHost *:80&amp;gt;
    DocumentRoot "/Users/andre/projects/rails/shapewiki/public"
    ServerName dev.shapewiki.com
    ErrorLog "/Users/andre/projects/rails/shapewiki/log/error.log"
  &amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Two things to note here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The ErrorLog line is optional. If you don't include it, the error output for this app will go to &lt;code&gt;/private/var/log/apache2/error.log&lt;/code&gt;. Not that that's bad, but you're probably not used to looking for Rails logs there.&lt;/li&gt;
&lt;li&gt;I decided to go with the convention of dev.[PRODUCTION_URL].com. You can use anything here, as long as it matches up with an entry in /etc/hosts (see below)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And here's an example &lt;code&gt;/etc/hosts&lt;/code&gt; addition to match the two virtual hosts above:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  127.0.0.1       dev.hotspotr.com
  127.0.0.1       dev.shapewiki.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's it! Go to (for example) http://dev.hotspotr.com, and you're hitting you local development app. There is nothing to start and stop. The first request for any app you hit will take a moment. Subsequent requests will feel quite snappy.&lt;/p&gt;

&lt;h2&gt;Let's Set up some Aliases to Make it all Flow&lt;/h2&gt;

&lt;p&gt;Here are the aliases I added to my &lt;code&gt;.bashrc&lt;/code&gt; file to give me quick access to everything I needed for a new, Passenger-centric workflow in my development environment:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Use this in any RAILS_ROOT dir. That restart.txt file tells mod_rails to restart this app.
# You'll want to do this when (for example) you install a new plugin.
alias restart_rails='touch tmp/restart.txt'

# By default, your app's error log now goes here. Unless you configure your apps otherwise, 
# it's helpful to have an alias to take you to your error log quickly.
alias apache_logs='cd /private/var/log/apache2/'

# You'll be adding to your vhosts configuration everytime you introduce a new Rails app. 
# Might as well make it a shortcut
alias vhosts='sudo vi /private/etc/apache2/extra/httpd-vhosts.conf'

# Dito with hosts
alias hosts='sudo vi /etc/hosts'

# You'll need to restart apache whenever you make a change to vhosts. 
# You can also click System Preference-&amp;gt;Sharing-&amp;gt;Web Sharing, but this is quicker.
alias apache_restart='sudo apachectl restart'
&lt;/code&gt;&lt;/pre&gt;

</description>
      <pubDate>Tue, 27 May 2008 08:18:00 EST</pubDate>
      <guid>&lt;a href="/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac"&gt;Development with Rails + Passenger (AKA mod_rails) on Mac&lt;/a&gt;</guid>
      <link>&lt;a href="/articles/2008/05/27/development-with-rails-passenger-aka-mod_rails-on-mac"&gt;Development with Rails + Passenger (AKA mod_rails) on Mac&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
