<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Stephen Tudor</title>
	<atom:link href="http://www.stephentudor.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stephentudor.com</link>
	<description>Bits and tangents on geek life</description>
	<pubDate>Fri, 20 Jun 2008 13:20:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>ALA: Faux Absolute Positioning</title>
		<link>http://www.stephentudor.com/2008/06/20/faux-absolute-positioning/</link>
		<comments>http://www.stephentudor.com/2008/06/20/faux-absolute-positioning/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 13:20:58 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[ala]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/?p=12</guid>
		<description><![CDATA[One of my favorite web publications, A List Apart, has pushed an article about a new CSS layout technique that the author, Eric Sol, calls Faux Absolute Positioning. Up until now, I&#8217;d always relied primarily on floating divs. Other folks preferred using (real) absolute positioning, but that required the use of JavaScript to keep the [...]]]></description>
			<content:encoded><![CDATA[<p>One of my favorite web publications, A List Apart, has pushed an article about a new CSS layout technique that the author, Eric Sol, calls <a href="http://alistapart.com/articles/fauxabsolutepositioning">Faux Absolute Positioning</a>. Up until now, I&#8217;d always relied primarily on floating divs. Other folks preferred using (real) absolute positioning, but that required the use of JavaScript to keep the footer from smooshing&nbsp;things.</p>

<p>For gridtastic designs, this new technique appears to be the best answer CSS has to offer yet. The benefits of absolute positioning, but using relative positioning + negative margins so as not to break the layout. I plan to try this out on future sites I work on, so I withhold final judgment, but as things look right now, Eric Sol will end up as my new CSS rockstar&nbsp;hero.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/06/20/faux-absolute-positioning/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Amateur Hour Over at TechCrunch</title>
		<link>http://www.stephentudor.com/2008/04/23/amateur-hour-over-at-techcrunch/</link>
		<comments>http://www.stephentudor.com/2008/04/23/amateur-hour-over-at-techcrunch/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 16:57:45 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/?p=10</guid>
		<description><![CDATA[My response to Michael Arrington&#8217;s ignorant story blaming the recently departed Blaine Cook for Twitter&#8217;s&#160;problems.


  Criticizing Twitter and crucifying a departing Twitter engineer are two entirely different things. Taking one of his presentation slides out of context, conjecture, supposition, lack of any credible witnesses or evidence&#8230; This isn&#8217;t news, it&#8217;s a snipe at a [...]]]></description>
			<content:encoded><![CDATA[<p>My response to Michael Arrington&#8217;s <a href="http://www.techcrunch.com/2008/04/23/amateur-hour-over-at-twitter/" rel="nofollow">ignorant story</a> blaming the recently departed <a href="http://twitter.com/blaine">Blaine Cook</a> for Twitter&#8217;s&nbsp;problems.</p>

<blockquote>
  <p>Criticizing Twitter and crucifying a departing Twitter engineer are two entirely different things. Taking one of his presentation slides out of context, conjecture, supposition, lack of any credible witnesses or evidence&#8230; This isn&#8217;t news, it&#8217;s a snipe at a guy who knows a hell of a lot more about his job than you and your 2 Rails buddies. What do you have to gain from attempting to soil Blaine&#8217;s&nbsp;reputation?</p>
  
  <p>&#8220;Sitting next to&#8221; Rails developers does not equate to knowledge about scaling the highest-traffic Rails app there has ever been, any more than my having John Resig&#8217;s JavaScript book sitting on my shelf makes me a JS&nbsp;ninja.</p>
  
  <p>This story is a blatant smear job, nothing more. We&#8217;ll see who looks a little dumb when Twitter&#8217;s problems - which you don&#8217;t understand - continue long after Blaine&#8217;s&nbsp;departure.</p>
</blockquote>

<p>I particularly liked <a href="http://www.jeremymcanally.com/">Jeremy McAnally&#8217;s</a> <a href="http://www.techcrunch.com/2008/04/23/amateur-hour-over-at-twitter/#comment-2217883">well-worded</a> <a href="http://www.techcrunch.com/2008/04/23/amateur-hour-over-at-twitter/#comment-2218095">responses</a> in the comments. They sum up everything that is wrong with Arrington&#8217;s&nbsp;post:</p>

<blockquote>
  <p>Wow, this is the most unnecessarily vitriolic articles I’ve ever seen. Twitter and Blaine took Rails to places it hadn’t been before in terms of scale and traffic (just as other sites did with PHP, Java, ColdFusion, and so on), and so acting as if he’s some unskilled hippie that didn’t know what he was doing just makes you look like an idiot. Sure, they had some bumps along the way, but no one else had even gotten on the same road as them to encounter the bumps. Being forced to figure out things along the way because no one has done them before doesn’t make you an&nbsp;&#8220;amateur.&#8221;</p>
  
  <p>Even further, what the heck qualifies you to criticize someone’s ability to scale a website or doing anything remotely technical for that matter? You’re out of your league. Please stick to talking about business or whining about someone not giving you ad&nbsp;money.</p>
</blockquote>

<p>and&nbsp;later:</p>

<blockquote>
  <p>If you think your Rails guys or gals have their “fingers on the pulse of the Rails community” and they think that Blaine is Twitter’s problem, then they’re lying to you. People who, like, actually know Blaine and other Twitterers can offer you much better information rather than baseless, ad money driven drivel. I can put you in contact with them if you drop me an e-mail (or I’m sure that Coda would be very happy to offer you any details you&nbsp;want).</p>
  
  <p>Of course, investigation probably isn’t your thing since you don’t know much about&nbsp;journalism.</p>
</blockquote>

<p>Indeed, it&#8217;s totally unacceptable that this kind of <a href="http://www.techcrunch.com/2008/04/23/amateur-hour-over-at-twitter/" rel="nofollow">tripe</a> passes for responsible journalism. Oh wait – it doesn&#8217;t. Perhaps people like Michael Arrington are part of the reason more legitimate blogs don&#8217;t get their journalistic&nbsp;kudos.</p>

<p>I don&#8217;t subscribe to TechCrunch, and frankly, after this display, I&#8217;m not about to. There are plenty of people Arrington could have asked to get the straight scoop, like, you know, a real journalist would&nbsp;have.</p>

<p>Some would say that exaggeration and overstatement is necessary to make an impact. Perhaps, but at what cost? A person&#8217;s reputation? For what purpose? To infuriate conscientious geeks? To generate a few hundred extra click-throughs? To wield power great and&nbsp;terrible?</p>

<p>Do your homework, don&#8217;t stomp on people who don&#8217;t deserve it, and the blogosphere will be a much more civil and harmonious&nbsp;place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/04/23/amateur-hour-over-at-techcrunch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Rails and Django Guides</title>
		<link>http://www.stephentudor.com/2008/04/23/new-rails-django-guides/</link>
		<comments>http://www.stephentudor.com/2008/04/23/new-rails-django-guides/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 14:42:15 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/?p=9</guid>
		<description><![CDATA[A List Apart, the famous online magazine &#8220;for people who make websites,&#8221; just published a pair of articles that help people who want to start out with Ruby on Rails: Getting Started with Ruby on Rails and Creating More Using Less Effort with Ruby on&#160;Rails.

No more than a day later, Digital Web responded with an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://alistapart.com">A List Apart</a>, the famous online magazine &#8220;for people who make websites,&#8221; just published a pair of articles that help people who want to start out with Ruby on Rails: <a href="http://alistapart.com/articles/gettingstartedwithrubyonrails">Getting Started with Ruby on Rails</a> and <a href="http://alistapart.com/articles/creatingmoreusinglesseffortwithrubyonrails">Creating More Using Less Effort with Ruby on&nbsp;Rails</a>.</p>

<p>No more than a day later, <a href="http://www.digital-web.com">Digital Web</a> responded with an <a href="http://www.digital-web.com/articles/intro_to_django_helping_perfectionists_with_deadlines/">Introduction to Django</a>. I just find it interesting that we have all of this in the same&nbsp;week.</p>

<p><a href="http://www.rubyonrails.org">Ruby on Rails</a> and <a href="http://www.djangoproject.com">Django</a> are competing web application frameworks that follow the <abbr title="Model View Controller">MVC</abbr> pattern. Rails is built on the <a href="http://www.ruby-lang.org">Ruby</a> programming language, while Django uses <a href="http://www.python.org">Python</a>. It&#8217;s friendly competition, of course&#8230; it all boils down to whether you&#8217;re a Pythonista or a&nbsp;Rubyist.</p>

<p>I am a huge fan of Rails, but I&#8217;d also like to learn more about Django&#8230; that is, if I can overcome my own Ruby vs. Python bias. One of my fondest memories of SXSW this year was hearing <a href="http://randsinrepose.com">Michael Lopp</a> ask from the stage, &#8220;What&#8217;s wrong with this Python code?&#8221; and someone in the audience called out, &#8220;It&#8217;s not&nbsp;Ruby!&#8221;</p>

<p>Oooh,&nbsp;snap!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/04/23/new-rails-django-guides/feed/</wfw:commentRss>
		</item>
		<item>
		<title>No Surprise Here&#8230;</title>
		<link>http://www.stephentudor.com/2008/04/14/no-surprise-here/</link>
		<comments>http://www.stephentudor.com/2008/04/14/no-surprise-here/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 16:17:54 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[bsg]]></category>

		<category><![CDATA[television]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/?p=8</guid>
		<description><![CDATA[

Somehow, deep down, I always knew I was a&#160;Cylon.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.buddytv.com/closedquiz/closed-quiz.aspx?quiz=21"><img src="http://www.buddytv.com/closedquiz/images/results/bsg-tyrol.jpg" alt="You are Chief Tyrol" /></a></p>

<p>Somehow, deep down, I always knew I was a&nbsp;Cylon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/04/14/no-surprise-here/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing nginx and PHP with FastCGI on Mac OS X 10.5 (Leopard)</title>
		<link>http://www.stephentudor.com/2008/04/02/installing-nginx-and-php-with-fastcgi-on-mac-os-x-105-leopard/</link>
		<comments>http://www.stephentudor.com/2008/04/02/installing-nginx-and-php-with-fastcgi-on-mac-os-x-105-leopard/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 14:04:58 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/2008/04/02/install-nginx-php-fcgi-fastcgi-mac-os-x-leopard/</guid>
		<description><![CDATA[These are instructions for how to install nginx (pronounced as &#8220;Engine X&#8221;, a high-performance open source web server) and PHP with FastCGI on a Mac for development purposes. I spent quite a bit of time figuring out how to do this on my own, so hopefully it will save someone else a little time. For [...]]]></description>
			<content:encoded><![CDATA[<p>These are instructions for how to install <strong>nginx</strong> (pronounced as &#8220;Engine X&#8221;, a high-performance open source web server) and <strong>PHP</strong> with <strong>FastCGI</strong> on a Mac for development purposes. I spent quite a bit of time figuring out how to do this on my own, so hopefully it will save someone else a little time. For the record, I was using <strong>Mac OS X 10.5 (Leopard)</strong> on a white Intel Core Duo MacBook at the time of this writing. There isn&#8217;t anything terribly non-standard about my particular setup that is worth mentioning, other than a larger-than-standard hard drive and 3rd-party RAM. Obviously, none of this will work on a PC running Windows or Linux, although there are a bunch of places you can go to find out how to install nginx on other platforms. This article, however, focuses only on the Mac&nbsp;platform.</p>

<p><span id="more-7"></span></p>

<p><strong>Update:</strong> <em>I am having a bear of a time with the</em> <code>launchd</code> <em>plist for starting up the PHP FastCGI daemon. I can&#8217;t find the reason why this plist, after loading successfully with the</em> <code>launchctl</code> <em>utility, doesn&#8217;t load at all upon the next startup. Meanwhile, plenty of other</em> <code>launchd</code> <em>plists have no problem loading on startup. Baffled for the moment, and hating plists right now. Why couldn&#8217;t Apple have just gone with more conventional init scripts for spawning daemon processes at startup?</em>&nbsp;<code>&lt;/whine&gt;</code></p>

<p>Many thanks to <a href="http://hivelogic.com">Dan Benjamin</a> and <a href="http://robbyonrails.com">Robby Russell</a>, whose articles on similar subjects have helped me numerous times in the past, and inspired me to attempt a walk-through of my&nbsp;own.</p>

<p>Most importantly, I must stress that the contents of this article are provided <strong>as is</strong>, I do not claim to be an expert in any of the material I cover here, and I will be unable to provide technical support for these solutions. Feel free to leave a comment, of course, and I&#8217;ll do my best to correct any errata! I am not underwritten or funded by any professional organization, and everything I am writing is, to the best of my knowledge, as accurate as I can make it. This is the fruit of my own personal trial and error, and is also based on various sources I found on the Web. At the bottom, I&#8217;ve given <a href="#attribution">attribution</a> to these sources as I can&nbsp;recall.</p>

<h2>Preamble</h2>

<p>What you&#8217;re thinking is absolutely true. You <em>do</em> have to be a dyed-in-the-wool geek to even come close to caring about what I am about to say. This is not terribly hard material if you have a little experience with web development&thinsp;&#8212;&thinsp;indeed, for some of you, this is probably old news, although I haven&#8217;t found very many resources on this exact topic. For most of the rest of the populace, however, this may all be greek to you. You have my reprieve if you want to stop reading now and go update your <a href="http://facebook.com">Facebook</a> profile. No&nbsp;worries.</p>

<p>In this article, there will be some Command-Line Fu. You&#8217;ve been warned. Get Mr. Terminal out and dust him off. You will need&nbsp;him.</p>

<p>Unlike <a href="http://hivelogic.com">some people</a>, I personally don&#8217;t mind relying on <a href="http://www.macports.org">MacPorts</a>. I don&#8217;t often find myself in desperate need of the latest and greatest versions of open-source software, and being a rather disorganized person, I find any package manager that handles dependencies for me to be a Godsend. For my purposes, MacPorts is just such a package manager. Of course, when I have to, I&#8217;ll compile from source manually in true haXor fashion. 99% of the time, however, MacPorts gets it done for&nbsp;me.</p>

<p>Before you even get to install MacPorts, though, you need to have Apple&#8217;s humongous <a href="http://developer.apple.com/tools/download">XCode tools</a> installed. Robby Russell of PLANET ARGON wrote up a great summary of getting your development environment in order in the first part of his latest article on <a href="http://www.robbyonrails.com/articles/2008/01/22/installing-ruby-on-rails-and-postgresql-on-os-x-third-edition">installing Rails and PostgreSQL on Mac OS X</a>. Read and follow <em>Phase One</em> of that article, which covers XCode and MacPorts, and you&#8217;ll be all set to get started here with nginx and FastCGI. If you already have XCode and MacPorts set up and working, <a href="#installing_nginx">skip&nbsp;ahead</a>.</p>

<p>As an aside, you might even want to go all the way through Robby&#8217;s tutorial and install Ruby on Rails too - if you&#8217;re a web developer and you haven&#8217;t yet checked out this awesome web application framework, you owe it to yourself. It could very well change your life. You can pick up back here when you&#8217;re&nbsp;done.</p>

<h3 id="installing_nginx">Installing&nbsp;nginx</h3>

<p>According to the <a href="http://wiki.codemongers.com">nginx English&nbsp;wiki</a>:</p>

<blockquote>
  <p>Nginx was written by <a href="http://sysoev.ru/en/">Igor Sysoev</a> for <a href="http://www.rambler.ru/">rambler.ru</a>, Russia&#8217;s second-most visited website, where it has been running in production for over two and a half years. Igor has released the source code under a BSD-like license. Although still in beta, Nginx is known for its stability, rich feature set, simple configuration, and low resource&nbsp;consumption.</p>
</blockquote>

<p>Are you ready to give it a spin? Assuming that you&#8217;re up and running with MacPorts, you are now ready to install the mighty nginx web server on your Mac. This really is the easy part of the process. Open up Terminal if it&#8217;s not already running, and type the following command at the&nbsp;prompt:</p>

<pre><code>sudo port install nginx
</code></pre>

<p>This will instruct MacPorts to download the nginx source, compile it, and install it in <code>/opt/local</code>. When it is nearly finished, the script should inform you that there is a property list you need to load via <code>launchctl</code> that will enable nginx to start on system&nbsp;reboot:</p>

<pre><code>###########################################################
# A startup item has been generated that will aid in
# starting nginx with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
###########################################################
</code></pre>

<p>If you want nginx to launch at startup, execute that command once the installation&nbsp;completes:</p>

<pre><code>sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
</code></pre>

<p>Otherwise, you can run the nginx daemon manually (but wait a moment before doing&nbsp;so):</p>

<pre><code>sudo /opt/local/sbin/nginx
</code></pre>

<p>Finally, before you can run nginx, you need to create a working default nginx configuration file,&nbsp;thusly:</p>

<pre><code>sudo cp /opt/local/etc/nginx/nginx.conf.default \
        /opt/local/etc/nginx/nginx.conf
</code></pre>

<p>This file as is should be sufficient to get you started. There are a number of resources available for tailoring the nginx configuration to your needs. I&#8217;ve listed a few of them at the end of this tutorial, but as I&#8217;m not an expert on nginx configuration, I&#8217;ll let them do the explaining, and just mumble something like, &#8220;that&#8217;s outside the scope of this article,&#8221; or some-such. Gotta fight that scope&nbsp;creep!</p>

<p>Just kidding. I&#8217;ll list some example config files at the end of this article, after I cover how to install PHP. That&#8217;s&nbsp;next.</p>

<h2>Installing PHP with&nbsp;FastCGI</h2>

<p>PHP, the way we have to run it, is a bit tricky to install. We have to run PHP as a CGI daemon independently of nginx, because unlike Apache, nginx doesn&#8217;t have anything like a <code>mod_php</code> that we can simply plug in. Despite that complication, the performance benefits of nginx still outstrip the many conveniences of bloated Apache, at least in my&nbsp;view.</p>

<p>If you&#8217;re running Leopard, you technically already have PHP installed (This could also be the case with Mac OS X 10.4, or Tiger). However, just so we can know exactly (well, roughly) what we&#8217;re getting, we can just install a separate instance of PHP with MacPorts. Because MacPorts installs everything into <code>/opt/local</code>, and the existing PHP is installed in <code>/usr/bin</code>, never the twain shall meet. They&#8217;ll never know about each other. No marital infidelity jokes, now. Run&nbsp;this:</p>

<pre><code>sudo port install php5 +fastcgi fcgi
</code></pre>

<p>MacPorts will again run off and download/compile/install a whole slew of dependencies, eventually getting around to PHP with FastCGI. If we&#8217;d compiled from source, I probably would have forgotten to tell you about one or two of them, and you&#8217;d be screwed. I like MacPorts because I am lazy and&nbsp;forgetful.</p>

<p>The installation script of PHP doesn&#8217;t provide you with a property list to load via <code>launchctl</code>, so we&#8217;ll have to roll our own. Create a new text file somewhere, name it whatever you like (I called mine <code>com.tudorstudio.php-fastcgi.plist</code>), and copy this&nbsp;in:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;Debug&lt;/key&gt;
  &lt;false/&gt;
  &lt;key&gt;EnvironmentVariables&lt;/key&gt;
  &lt;dict&gt;
    &lt;key&gt;PHP_FCGI_CHILDREN&lt;/key&gt;
    &lt;string&gt;2&lt;/string&gt;
    &lt;key&gt;PHP_FCGI_MAX_REQUESTS&lt;/key&gt;
    &lt;string&gt;1000&lt;/string&gt;
  &lt;/dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;com.tudorstudio.phpfcgi&lt;/string&gt;
  &lt;key&gt;OnDemand&lt;/key&gt;
  &lt;false/&gt;
  &lt;key&gt;ProgramArguments&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/opt/local/bin/php-cgi&lt;/string&gt;
    &lt;string&gt;-b 127.0.0.1:9000&lt;/string&gt;
    &lt;string&gt;-q&lt;/string&gt;
  &lt;/array&gt;
  &lt;key&gt;RunAtLoad&lt;/key&gt;
  &lt;false/&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>

<p>As configured above, the daemon will run on port 9000, and spawn 2 child processes. Feel free to change those values to fit your needs. Notice that the filename (<code>com.tudorstudio.phpfcgi</code> in the above example) is referenced on about line 15; I&#8217;d recommend that you change that to whatever you named your own PLIST. You are free to use my filename if you&nbsp;like.</p>

<p>Now, in the same directory as your newly created property list, run the command to load it into your launchd configuration, like so (again, changing the filename to match your&nbsp;file):</p>

<pre><code>sudo launchctl load -w com.tudorstudio.php-fastcgi.plist
</code></pre>

<p>This tells <code>launchd</code> to launch our FastCGI daemon process at system startup. If you wish, you can run this daemon&nbsp;manually:</p>

<pre><code>sudo /opt/local/bin/php-cgi -q -b 127.0.0.1:9000
</code></pre>

<p>There is also a shell script that can simplify the command for you - it&#8217;s listed at the&nbsp;bottom.</p>

<h2>Config&nbsp;Files</h2>

<p>As promised, here are some example configuration files for nginx on the Mac. These are pretty close to what I&#8217;m currently using, but I don&#8217;t claim to be very knowledgeable in this area - it&#8217;s just what works for me, and I&#8217;m sure I&#8217;m just barely scratching the surface. All three of these config files are located in&nbsp;<code>/opt/local/etc/nginx</code>.</p>

<hr />

<h3>nginx.conf</h3>

<pre><code># user nobody;
worker_processes  1;

error_log  /opt/local/var/log/nginx/error.log;
pid        /opt/local/var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /opt/local/etc/nginx/mime.types;
    default_type  application/octet-stream;

    access_log  /opt/local/var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;

    include /opt/local/etc/nginx/sites.conf;
}
</code></pre>

<hr />

<h3>sites.conf</h3>

<pre><code># You may add here your
# server {
#       ...
# }
# statements for each of your virtual hosts

server {
    listen 80;
    server_name localhost;
    # server_name example.com;

    access_log  /opt/local/var/log/nginx/localhost.access.log;

    location / {
        root   /opt/local/share/nginx/html;
        index  index.php index.html index.htm;
    }

    #error_page  404  /404.html;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /opt/local/share/nginx/html;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /opt/local/share/nginx/html$fastcgi_script_name;
        include       /opt/local/etc/nginx/fastcgi.conf;
    }
}
</code></pre>

<hr />

<h3>fastcgi.conf</h3>

<pre><code>fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
</code></pre>

<hr />

<h3>php_fastcgi.sh</h3>

<p>As promised, here is an example of a bash script that can be used to simplify the spawning of the PHP-CGI daemon. Please use responsibly, and alter it as you see&nbsp;fit.</p>

<pre><code>#!/bin/bash
# From http://blog.kovyrin.net/2006/05/30/nginx-php-fastcgi-howto/
# Modified per http://henrik.nyh.se/2008/02/php-in-nginx-on-os-x.
# Further modified by Stephen Tudor for private use.

## ABSOLUTE path to the PHP binary
PHPFCGI="/opt/local/bin/php-cgi"

## tcp-port to bind on
FCGIPORT="9000"

## IP to bind on
FCGIADDR="127.0.0.1"

## number of PHP children to spawn
PHP_FCGI_CHILDREN=2

## number of request before php-process will be restarted
PHP_FCGI_MAX_REQUESTS=1000

# allowed environment variables sperated by spaces
ALLOWED_ENV="PATH USER"

## if this script is run as root switch to the following user
USERID=nobody

################## no config below this line

ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN"
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS"
ALLOWED_ENV="$ALLOWED_ENV FCGI_WEB_SERVER_ADDRS"

if test x$UID = x0; then
  EX="/usr/bin/sudo -u $USERID $PHPFCGI -q -b \"$FCGIADDR:$FCGIPORT\"" 
else
  EX="$PHPFCGI -b $FCGIADDR:$FCGIPORT"
fi

echo $EX

# copy the allowed environment variables
E=

for i in $ALLOWED_ENV; do
  E="$E $i=${!i}"
done

# clean environment and set up a new one
nohup env - $E sh -c "$EX" &amp;&gt; /dev/null <span class="amp">&amp;</span>
</code></pre>

<hr />

<h2>Conclusion</h2>

<p>I hope that you found this article useful in getting you on your way with nginx and PHP with FastCGI on Mac OS X. I have no reason to believe this wouldn&#8217;t work just as well with Tiger as it does Leopard, but since Leopard is what I&#8217;ve got to work with,&nbsp;YMMV.</p>

<h3 id="attribution">Attribution</h3>

<p>For the most authoritative, albeit terse, information on nginx in English, head on over to the <a href="http://wiki.codemongers.com">nginx English wiki</a> and drink in as much as you&nbsp;can.</p>

<p>For the majority of what I included here in this little exercise, I owe beer&nbsp;to:</p>

<ul>
<li><strong>Henrik Nyh</strong>, who wrote <a href="http://henrik.nyh.se/2008/02/php-in-nginx-on-os-x">one of the only Mac/nginx/php articles I could find</a>, and put up a pastie of an <a href="http://pastie.textmate.org/146715">example FCGI shell&nbsp;script</a>.</li>
<li><strong>Matthew King</strong>, who posted the original snippet of an <a href="http://snippets.dzone.com/posts/show/4115">example <code>launchd</code> property list for PHP with&nbsp;FCGI</a>.</li>
<li><strong>Chu Yeow</strong>, who listed some <a href="http://blog.codefront.net/2007/06/11/nginx-php-and-a-php-fastcgi-daemon-init-script/">awesome nginx config file&nbsp;examples</a>.</li>
<li><strong>Alexei Kovyrin</strong>, who posted a <a href="http://blog.kovyrin.net/2006/05/30/nginx-php-fastcgi-howto/">nice nginx/PHP/FCGI&nbsp;howto</a>.</li>
</ul>

<p>Thanks, guys, for being&nbsp;awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/04/02/installing-nginx-and-php-with-fastcgi-on-mac-os-x-105-leopard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>April Fooz</title>
		<link>http://www.stephentudor.com/2008/04/01/april-fooz/</link>
		<comments>http://www.stephentudor.com/2008/04/01/april-fooz/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 04:54:58 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[april-fools]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/2008/04/02/april-fooz/</guid>
		<description><![CDATA[I don&#8217;t have much to say about today&#8217;s frivolities, but I should that I avoided being rickrolled via Twitter an epic number of&#160;times.

Adactio has the full scoop on the April Fool&#8217;s pranks that went down on the Web in 2008. My personal favorite of the day was John Resig&#8217;s &#8220;release&#8221; of Classy Query, but then, [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t have much to say about today&#8217;s frivolities, but I should that I avoided being <a href="http://en.wikipedia.org/wiki/Rickroll">rickrolled</a> via <a href="http://twitter.com/sunblush">Twitter</a> an epic number of&nbsp;times.</p>

<p><a href="http://adactio.com" title="Jeremy Keith">Adactio</a> has the <a href="http://adactio.com/journal/1428" title="No Fooling">full scoop</a> on the April Fool&#8217;s pranks that went down on the Web in 2008. My personal favorite of the day was John Resig&#8217;s &#8220;release&#8221; of <a href="http://ejohn.org/blog/classy-query/">Classy Query</a>, but then, as Jeremy intimates, I&#8217;m obviously a code nerd. I particularly enjoyed Gordon&#8217;s <a href="http://ejohn.org/blog/classy-query/#comment-300723">comment</a> on that post, quoted&nbsp;here:</p>

<blockquote>
  <p>I&#8217;m glad that you&#8217;ve seen the light. Us old guys don&#8217;t want none of your fandangled duck-type magic fancypants&nbsp;crap.</p>
  
  <p>The old ways are the best&nbsp;ways!</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/04/01/april-fooz/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BSG Secret Society</title>
		<link>http://www.stephentudor.com/2008/03/28/bsg-secret-society/</link>
		<comments>http://www.stephentudor.com/2008/03/28/bsg-secret-society/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 13:11:21 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[bsg]]></category>

		<category><![CDATA[television]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/2008/03/28/bsg-secret-society/</guid>
		<description><![CDATA[The other day, I received this clandestine&#160;note.


  This is a reminder that there will be a meeting called tonight for the BSG-SS (Battlestar Galactica Secret Society) at ADDRESS DELETED. It is imperative that all attend, as there is limited time in which to watch Season 3 before the premier episode of Season 4 next [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I received this clandestine&nbsp;note.</p>

<blockquote>
  <p>This is a reminder that there will be a meeting called tonight for the BSG-SS (Battlestar Galactica Secret Society) at <strong>ADDRESS DELETED</strong>. It is imperative that all attend, as there is limited time in which to watch Season 3 before the premier episode of Season 4 next week. We at the BSG-SS do not take this&nbsp;lightly.</p>
  
  <p>There will be popcorn, soda and a festive&nbsp;atmosphere.</p>
  
  <p>BSG Forever &#92;&#92;&nbsp;&nbsp;//</p>
</blockquote>

<p>Apparently, I am a cloak-wearing member of this group, and I <em>may</em> have been participating in some Season 3 episode-cramming this week. But only if it&#8217;s strictly off the record. After all, who would openly admit to liking a show called Battlestar&nbsp;Galactica?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/03/28/bsg-secret-society/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Blogging with TextMate</title>
		<link>http://www.stephentudor.com/2008/03/22/blogging-with-textmate/</link>
		<comments>http://www.stephentudor.com/2008/03/22/blogging-with-textmate/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 01:14:38 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[plain text]]></category>

		<category><![CDATA[textmate]]></category>

		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/2008/03/24/blogging-with-textmate/</guid>
		<description><![CDATA[Until today, I&#8217;d never written a blog post before that wasn&#8217;t in the online editor window of the admin interface. That&#8217;s a bad idea for a couple of big reasons: you can&#8217;t save local copies of drafts without copying and pasting into a file; the server could lose its connection, drop your session, and your [...]]]></description>
			<content:encoded><![CDATA[<p>Until today, I&#8217;d never written a blog post before that wasn&#8217;t in the online editor window of the admin interface. That&#8217;s a bad idea for a couple of big reasons: you can&#8217;t save local copies of drafts without copying and pasting into a file; the server could lose its connection, drop your session, and your current writing along with it. Writing online can be a great convenience, but it&#8217;s also risky in that a lost connection could throw the baby out with the bath-water while you&#8217;re working on a particularly lengthy post, and all that hard work would be&nbsp;lost.</p>

<p>Those well-crafted turns of phrase? Gone. Those painstakingly sly aphorisms? They&#8217;re in the Internet&#8217;s ever-expanding <code>/dev/null</code> receptacle. As Murphy&#8217;s Law dictates, these sorts of situations tend to happen not just at the most inopportune moments you can imagine, but especially the ones you&nbsp;can&#8217;t.</p>

<p>Online blog editing was the whole of my blogging experience until today. Sure, I knew it wasn&#8217;t ideal, and I got bitten a few times by dropped sessions while editing a post, but that never prompted me to change my behavior or investigate any solutions to the issue. You win some, you lose some. It was good enough, I thought. I had heard from a many people in my lifetime that the best way to write is to write drafts. A crappy, yet uncensored, first draft to capture the energy of thought, followed by subsequent revisions to harness that energy and make it actually&nbsp;intelligible.</p>

<p>I&#8217;m not saying I&#8217;ll ever be a great (or even good) writer by starting to write drafts of blog posts, but I think it&#8217;s a step in the right direction. One critical component of my blogging process has to change, though: I have to abandon the online blog editor. Blogging through an online form just seems wrong anymore, not just for reliability&#8217;s sake, but for posterity&#8217;s sake&nbsp;too.</p>

<p>I&#8217;ve been a proponent of plain text for a couple of years, thanks mainly to Merlin Mann&#8217;s <a href="http://www.43folders.com/topics/plain-text">pontifications on the subject</a>. Plain text is the best data format. It&#8217;s ubiquitous, and very nearly infinitely backwards- <em>and</em> forwards-compatible (aside from the difference in Windows/Unix newline characters). A ton of other data formats are built on top of plain text: HTML, XML, YAML, CSS, CSV, JSON&#8230; but plain text is the key. You can pretty much rest assured that your data will be accessible 50 years from now if you store it in plain&nbsp;text.</p>

<p>When it comes to editing plain text on the Mac environment (my platform of choice), <a href="http://macromates.com">TextMate</a> sits on the top of the heap. For me, it&#8217;s a Swiss Army knife of editing <em>anything</em>. TextMate&#8217;s awesome bundle API makes it totally extensible. I do nearly all my web development work on TextMate (in combination with Terminal and Firefox/Firebug), so why not blogging too? TextMate <em>does</em> have a Blogging&nbsp;bundle.</p>

<p>After configuring it with this blog&#8217;s XML-RPC script, I was able to post new articles and edit existing blog posts in TextMate. On top of that, I can keep and maintain a local record of all of my drafts for future blog posts in plain text! This post was, in fact, written in and posted via XML-RPC with TextMate. Too&nbsp;easy.</p>

<p>I&#8217;m never going back if I can help&nbsp;it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/03/22/blogging-with-textmate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thought Leaders</title>
		<link>http://www.stephentudor.com/2008/03/21/thought-leaders/</link>
		<comments>http://www.stephentudor.com/2008/03/21/thought-leaders/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 19:12:06 +0000</pubDate>
		<dc:creator>stephen</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[sxsw]]></category>

		<guid isPermaLink="false">http://www.stephentudor.com/?p=1</guid>
		<description><![CDATA[After a pretty long hiatus from blogging, I&#8217;m finally starting anew. This time, I&#8217;m happy to announce that I&#8217;ll be writing as myself, rather than hiding behind hideously &#8217;90s social constructs like screen-names and what-all. This time,&#160;WYSIWYG.

I won&#8217;t pretend to believe that very many people even knew about me, or missed me, but to those [...]]]></description>
			<content:encoded><![CDATA[<p>After a pretty long hiatus from blogging, I&#8217;m finally starting anew. This time, I&#8217;m happy to announce that I&#8217;ll be writing as myself, rather than hiding behind hideously &#8217;90s social constructs like screen-names and what-all. This time,&nbsp;WYSIWYG.</p>

<p>I won&#8217;t pretend to believe that very many people even knew about me, or missed me, but to those who did,&nbsp;thanks.</p>

<p>Now that that&#8217;s out of the way, I&#8217;d like to share one of my finest memories from Austin this year. My wife, Sarah, and I went to <a href="http://2008.sxsw.com/">South by Southwest</a>, she to the <a href="http://2008.sxsw.com/film/">film festival</a> and I to the <a href="http://2008.sxsw.com/interactive/">interactive web nerd-athon</a>. What made my week wasn&#8217;t the weather, which was downright frigid and damp at times. It wasn&#8217;t the food, which started out as this amazing novelty, but after a week of Tex-Mex and chicken-fried steak, I just wanted a good old PBJ. No, the highlights for me were, not surprisingly, the people I met (and almost-met), and the incredible panels I was fortunate enough to attend. OK, and maybe a party or&nbsp;two!</p>

<p>Some of the panels actually made some brave incursions into niche comedy, defying their very panel-ness. In particular, <a href="http://rooreynolds.com/2008/03/08/sxsw-day-2-worst-website-ever/">Merlin Mann&#8217;s pitch</a> for the <a href="http://2008.sxsw.com/interactive/programming/panels_schedule/?action=show&amp;id=IAP060532">Worst Website Ever</a> un-panel had a room packed with geeks eating out of his hand. <strong>Warning:</strong> If you&#8217;re not a web geek, you may not find this very funny. But if so&#8230; enjoy. You&#8217;ve probably seen this already,&nbsp;though.</p>

<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler"><param name="movie" value="http://www.viddler.com/player/39ef6fd4/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/39ef6fd4/" width="437" height="370" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler" ></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephentudor.com/2008/03/21/thought-leaders/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.501 seconds -->
