<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>crigor.com &#187; Uncategorized</title>
	<atom:link href="http://crigor.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://crigor.com</link>
	<description></description>
	<lastBuildDate>Sun, 20 Dec 2009 09:18:44 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing Nginx with Passenger on Snow Leopard Using MacPorts</title>
		<link>http://crigor.com/nginx-passenger-snow-leopard-macports/</link>
		<comments>http://crigor.com/nginx-passenger-snow-leopard-macports/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 09:18:44 +0000</pubDate>
		<dc:creator>crigor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://crigor.com/?p=3</guid>
		<description><![CDATA[Install MacPorts if you don&#8217;t have it.
Download and install the Portfile

git clone git://github.com:crigor/admoolabs-ports.git ports
cd ports/nginx-0.7.64-passenger-2.2.8
sudo port -v install

You need to have ruby installed to compile passenger. In case you don&#8217;t have ruby, you can also get it from macports.
sudo port -v install ruby
If you have an older version of nginx installed using macports, it might [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.macports.org/install.php">Install MacPorts</a> if you don&#8217;t have it.</p>
<p>Download and install the Portfile</p>
<pre class="brush: bash; auto-links: false; light: true;">
git clone git://github.com:crigor/admoolabs-ports.git ports
cd ports/nginx-0.7.64-passenger-2.2.8
sudo port -v install
</pre>
<p>You need to have ruby installed to compile passenger. In case you don&#8217;t have ruby, you can also get it from macports.</p>
<pre class="brush: bash; light: true;">sudo port -v install ruby</pre>
<p>If you have an older version of nginx installed using macports, it might move nginx.conf to nginx.conf.altered. Copy it back to nginx.conf if you need it. You can also use this <a href="http://gist.github.com/258789">nginx.conf</a>.</p>
<p>Edit /opt/local/etc/nginx.conf and add the following lines inside http {}</p>
<pre class="brush: bash; light: true;">
passenger_root /opt/local/lib/passenger;
passenger_ruby /opt/local/bin/ruby;
</pre>
<p>Change the ruby path if you&#8217;re not using ruby from macports.</p>
<p>For each rails app, you need to add the following, also inside http {}</p>
<pre class="brush: bash; auto-links: false; light: true;">
server {
  server_name labs.local;
  root /Users/crigor/admoolabs/labs/public;
  access_log /opt/local/var/log/nginx/labs.local.access.log;
  error_log /opt/local/var/log/nginx/labs.local.error.log;
  passenger_enabled on;
  rails_env development;
}
</pre>
<p>Check if your syntax is correct.</p>
<pre class="brush: bash; light: true;">
sudo /opt/local/sbin/nginx -t
</pre>
<p>If it is, you&#8217;ll see</p>
<pre class="brush: bash; light: true;">
the configuration file /opt/local/etc/nginx/nginx.conf syntax is ok
configuration file /opt/local/etc/nginx/nginx.conf test is successful
</pre>
<p>Start nginx with</p>
<pre class="brush: bash; light: true;">
sudo /opt/local/sbin/nginx
</pre>
<p>You won&#8217;t get any output if it starts correctly. Check if nginx is running</p>
<pre class="brush: bash; light: true;">
ps -e | grep nginx -i
(You should see something like these lines)
nginx: master process /opt/local/sbin/nginx
nginx: worker process
PassengerNginxHelperServer /opt/local/lib/passenger /opt/local/bin/ruby 3 4 0 6 0 300 1 nobody 4294967294 4294967294 /tmp/passenger.10755
</pre>
<p>MacPorts added a startup item which is disabled by default. To start it,</p>
<pre class="brush: bash; light: true;">
sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
</pre>
<p>You can stop nginx with</p>
<pre class="brush: bash; light: true;">
sudo launchctl stop org.macports.nginx
</pre>
<p>but it would just be started right away. If you want it to remain stopped, use</p>
<pre class="brush: bash; light: true;">
sudo launchctl unload /Library/LaunchDaemons/org.macports.nginx.plist
</pre>
<p>When you make changes to the config, reload the config with</p>
<pre class="brush: bash; light: true;">
sudo /opt/local/sbin/nginx -s reload
</pre>
<p>Check the other nginx options using</p>
<pre class="brush: bash; light: true;">/opt/local/sbin/nginx -h</pre>
<p>One more thing&#8230;<br />
When you add a rails or rack app, you need to specify a different server_name. You need to add it to /etc/hosts</p>
<pre class="brush: bash; light: true;">
127.0.0.1 localhost labs.local
</pre>
<p>Don&#8217;t you think it would be great if you can handle this automatically? Me too. Stay tuned for more. This shouldn&#8217;t be a <del>pane</del> pain. <img src='http://crigor.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://crigor.com/nginx-passenger-snow-leopard-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://crigor.com/hello-world/</link>
		<comments>http://crigor.com/hello-world/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 09:00:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://crigor.com/?p=1</guid>
		<description><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
]]></description>
			<content:encoded><![CDATA[<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
]]></content:encoded>
			<wfw:commentRss>http://crigor.com/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
