<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ruby on Rails</title>
	<atom:link href="http://candidcode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://candidcode.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 13 Jan 2010 08:06:52 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='candidcode.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/713b718f731ee3b7d9172452d727e817?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ruby on Rails</title>
		<link>http://candidcode.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://candidcode.com/osd.xml" title="Ruby on Rails" />
	<atom:link rel='hub' href='http://candidcode.com/?pushpress=hub'/>
		<item>
		<title>A guide to getting the hg-git Mercurial plugin to work on a Windows machine</title>
		<link>http://candidcode.com/2010/01/12/a-guide-to-converting-from-mercurial-hg-to-git-on-a-windows-client/</link>
		<comments>http://candidcode.com/2010/01/12/a-guide-to-converting-from-mercurial-hg-to-git-on-a-windows-client/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 23:27:30 +0000</pubDate>
		<dc:creator>praveendiangy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://candidcode.com/?p=73</guid>
		<description><![CDATA[When you&#8217;re developing a Ruby on Rails application on Windows, you have to learn to deal with a lot of minor issues. I used Mercurial (Hg) initially as my source control. However when time came to deploy my application, I found out that Git would have been a much better choice. Both Heroku and Engine [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=73&subd=candidcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re developing a Ruby on Rails application on Windows, you have to learn to deal with a lot of minor issues. I used Mercurial (Hg) initially as my source control. However when time came to deploy my application, I found out that Git would have been a much better choice. Both <a title="Heroku" href="http://heroku.com/" target="_blank">Heroku</a> and <a title="Engine Yard" href="http://www.engineyard.com" target="_blank">Engine Yard</a> make Ruby on Rails so easy to deploy that it would  be crazy not to use them. However they integrate with Git and Mercurial support seems a long way off.</p>
<p>So I decided to convert my Mercurial repository to Git using the hg-git Mercurial plugin and ran into a lot of issues along the way. Here is a guide to successfully getting the hg-git plugin to work on a Windows machine:</p>
<h3>1. Install TortoiseHg if you haven&#8217;t already</h3>
<p>If you&#8217;re developing on Windows and using Hg, you probably already have TortoiseHg installed. If not, go ahead and <a title="Download TortoiseHg" href="http://tortoisehg.bitbucket.org/" target="_blank">download and install TortoiseHg</a>. Make a note of where you install TortoiseHg, since you need to make some modifications in this directory.</p>
<h3>2. Install the prerequisites for the hg-git plugin</h3>
<p>We&#8217;re going to use the hg-git Mercurial plugin to allow us to pull from and push to any Git repository. This has a dependence on Mercurial (which is handled by installing TortoiseHg in the previous step) and <a title="dulwich" href="http://github.com/jelmer/dulwich" target="_blank">dulwich</a> which is a library that provides an interface to git repos using pure Python code.</p>
<p>However since you most probably don&#8217;t have Python installed on your Windows machine, follow these steps to &#8220;install&#8221; the dulwich library for use by the hg-git plugin:</p>
<ol>
<li><a href="http://github.com/jelmer/dulwich/downloads" target="_blank">Download the latest source code</a> for dulwich (version 0.4.0 or above) and unzip it to a temporary directory</li>
<li>IMPORTANT: Read the note at the bottom of the post for troubleshooting. You might need to make a change to a file in the dulwich folder in order for it to work on Windows.</li>
<li>Under the newly unzipped folder, you should see a directory called &#8220;dulwich&#8221; which contains all the Python code (you should see a bunch of files with the .py extension)</li>
<li>In the installation directory for your TortoiseHg installation, you should see a zip file called library.zip. Copy the dulwich folder into this zip file in the root of the zip file.</li>
</ol>
<h3>3. Download the source code for the hg-git Mercurial plugin</h3>
<p>Clone the repository at http://bitbucket.org/durin42/hg-git/ to a location on your hard drive, say C:\hg\hg-git</p>
<h3>4. Setup .hgrc to use the hg-git plugin</h3>
<p>Navigate to the hg repository on your hard drive that you want to convert to Git. Under the .hg directory, edit the hgrc file to contain the following three lines:</p>
<p>[extensions]<br />
hgext.bookmarks =<br />
hggit = C:\hg\hg-git\hggit</p>
<p>You need to point hggit in your hgrc file to point to the subdirectory called &#8220;hggit&#8221; located in the cloned repository (see step 3 above). This folder usually only contains Python code files (with a .py extension)</p>
<h3>5. Pull and push from a Git repository</h3>
<p>That&#8217;s it! Provided your current working directory is inside the hg repository that you set up, you should be able to pull from and push to any Git repository.</p>
<h3>Troubleshooting</h3>
<p>1. If you&#8217;re getting a error about a function called build_tree in index.py, you need to add the line  to the very top of the build_tree(path) method as follows. Once you&#8217;ve added this line, you can add the dulwich folder to zip file as in step 2:</p>
<pre class="brush: python;">
def build_tree(path)
    path = path.replace (&quot;\\&quot;, &quot;/&quot;)
</pre>
<p>2. If you&#8217;re getting an error like &#8220;abort: The system cannot find the file specified&#8221;, then dulwich cannot find ssh in your PATH. You need to make sure to install Cygwin&#8217;s OpenSSH and that you can run &#8220;ssh&#8221; from the command line.</p>
<p>3. If you get &#8220;Permission denied (publickey)&#8221;, it just means that the public key required to access and push to the server cannot be found. To get around this we&#8217;re going to run the following commands:</p>
<pre class="brush: bash;">
ssh-agent
ssh-add &lt;full path to your key file&gt;
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/candidcode.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/candidcode.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/candidcode.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/candidcode.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/candidcode.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/candidcode.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/candidcode.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/candidcode.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/candidcode.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/candidcode.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=73&subd=candidcode&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://candidcode.com/2010/01/12/a-guide-to-converting-from-mercurial-hg-to-git-on-a-windows-client/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686dbb8c68aa12ec355495849d1eeff5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">praveendiangy</media:title>
		</media:content>
	</item>
		<item>
		<title>Paginating multiple models using will_paginate on the same page</title>
		<link>http://candidcode.com/2009/11/03/paginating-multiple-models-using-will_paginate-on-the-same-page/</link>
		<comments>http://candidcode.com/2009/11/03/paginating-multiple-models-using-will_paginate-on-the-same-page/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 18:10:43 +0000</pubDate>
		<dc:creator>praveendiangy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mislav-will_paginate]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[will_paginate]]></category>

		<guid isPermaLink="false">http://candidcode.com/?p=33</guid>
		<description><![CDATA[The will_paginate plugin makes pagination for your models in Ruby on Rails ridiculously simple. However sometimes you&#8217;ll find yourself wanting to paginate over two or more models on a single page. For instance, you might want to display a list of users and administrators on a single page along with a pager for each model [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=33&subd=candidcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The <a title="will_paginate plugin" href="http://wiki.github.com/mislav/will_paginate" target="_blank">will_paginate</a> plugin makes pagination for your models in Ruby on Rails ridiculously simple. However sometimes you&#8217;ll find yourself wanting to paginate over two or more models on a single page. For instance, you might want to display a list of users and administrators on a single page along with a pager for each model (assuming that users and administrators are stored in separate tables).</p>
<h3>Controller code</h3>
<p>The code is pretty simple, except that I am specifying the page to show to be equal to params[:user_page] and params[:administrator_page] respectively. Since we are allowing the ability to page over two models, we need two separate parameters to determine which page of users or administrators to show.</p>
<pre class="brush: ruby;">
@users = User.paginate(:page =&gt; params[:user_page], :per_page =&gt; 10)
@administrators = Administrator.paginate(:page =&gt; params[:administrator_page], :per_page =&gt; 10)
</pre>
<h3>View code</h3>
<p>In the view all we need to do is make sure to set the param_value to the correct value to indicate to the plugin that we want to use a different parameter name for the page. The default is simply called &#8216;page&#8217;, but we need to make sure to use &#8216;user_page&#8217; and &#8216;administrator_page&#8217; instead for the two different models.</p>
<pre class="brush: ruby;">
&lt;%= will_paginate @users, :param_name =&gt; 'user_page' %&gt;
&lt;%= will_paginate @administrators, :param_name =&gt; 'administrator_page' %&gt;
</pre>
<p>That&#8217;s it, you should now be able to page through your users and administrators on the same page.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/candidcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/candidcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/candidcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/candidcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/candidcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/candidcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/candidcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/candidcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/candidcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/candidcode.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=33&subd=candidcode&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://candidcode.com/2009/11/03/paginating-multiple-models-using-will_paginate-on-the-same-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686dbb8c68aa12ec355495849d1eeff5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">praveendiangy</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing file uploads in Ruby on Rails with RSpec</title>
		<link>http://candidcode.com/2009/10/20/testing-file-uploads-in-ruby-on-rails-with-rspec/</link>
		<comments>http://candidcode.com/2009/10/20/testing-file-uploads-in-ruby-on-rails-with-rspec/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 16:47:09 +0000</pubDate>
		<dc:creator>praveendiangy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[file uploads]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://candidcode.com/?p=31</guid>
		<description><![CDATA[While working on my latest project,I wanted to drive the design of my file upload code using Behavior Driven Development using Webrat and RSpec. For most people, I would recommend using a plugin like Paperclip rather than reinvent the wheel, but if you&#8217;re interested in seeing how to use RSpec to drive the design of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=31&subd=candidcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>While working on my latest project,I wanted to drive the design of my file upload code using Behavior Driven Development using Webrat and RSpec. For most people, I would recommend using a plugin like <a title="File attachment plugin for Ruby on Rails" href="http://www.thoughtbot.com/projects/paperclip/" target="_blank">Paperclip</a> rather than reinvent the wheel, but if you&#8217;re interested in seeing how to use RSpec to drive the design of file upload code, read on.</p>
<p>I&#8217;m a big fan of Behavior Driven Development and all the code you see below was driven by a customer&#8217;s acceptance test for a vital business feature. In order to keep this simple, I&#8217;m just going to describe how I used RSpec to drive the file upload code, but feel free to read the <a title="The RSpec Book: Behaviour Driven Development with RSpec, Cucumber, and Friends" href="http://www.pragprog.com/titles/achbd/the-rspec-book" target="_blank">RSpec book</a> to get more information on BDD with Ruby on Rails.</p>
<h3>Designing the Document class</h3>
<p>Since all our business rules and logic belongs to our domain model, the Document class has to be smart. It should know how to store uploaded files on the server, how to handle file name clashes etc. The controller should be able to simply call a method on this class to store an uploaded file correctly. This is the RSpec example for the save_upload method in the Document class:</p>
<pre class="brush: ruby;">
it &quot;should be able to save an upload with an unique name generated by using a timestamp&quot; do
  # As of Rails 2.3.2, the framework passes an UploadedStringIO to the controller when uploading files
  # I'm creating a mock that I can pass to my save_upload method on my Document class.
  # The save_upload only requires that the passed in object respond to original_filename and read.
  uploaded_file = mock(ActionController::UploadedStringIO).as_null_object
  uploaded_file.stub!(:original_filename).and_return('test.doc')
  uploaded_file.stub!(:read).and_return(&quot;Some content&quot;)

  document = Document.new

  document.save_upload(uploaded_file)
  document.original_filename.should == &quot;test.doc&quot;
  # To prevent file name clashes, the saved file's new name is prepended with a timestamp
  document.new_filename.should =~ /\d{2}\d{2}\d{4}\d{2}\d{2}\d{2}-test.doc/
  # Finally, does the file exist on the file system and if so are the contents of this file correct?
  File.exist?(&quot;#{Rails.root}/public/system/documents/#{document.new_filename}&quot;).should == true
  File.open(&quot;#{Rails.root}/public/system/documents/#{document.new_filename}&quot;, &quot;r&quot;) { |f| f.read.should == uploaded_file.read }
end
</pre>
<h3>Implementing the Document class&#8217;s save_upload method</h3>
<p>Once we&#8217;ve got the RSpec example, writing the actual code to make the example pass is pretty simple.</p>
<pre class="brush: ruby;">
def save_upload(upload)
  self.original_filename = sanitize_file_name(upload.original_filename)
  self.new_filename = unique_filename
  # Write the file
  File.open(absolute_path, &quot;wb&quot;) { |f| f.write(upload.read) }
end

private
  def absolute_path
    File.join(Rails.root, 'public/system/documents', self.new_filename)
  end

  def sanitize_file_name(filename)
    # Internet explorer returns the complete path to the file, instead of just the file name that was uploaded.
    # File.basename gives us just the filename and fixes the above issue with Internet Explorer.
    # Replace everything other than alphanumeric characters, periods or underscores with underscores to ensure
    # there are no illegal characters
    File.basename(filename).gsub(/[^\w\.\_]/, '_')
  end

  def unique_filename
    # Prepend a timestamp to the original filename to create a unique filename
    Time.now.strftime(&quot;%m%d%Y%H%M%S&quot;).to_s + &quot;-#{self.original_filename}&quot;
  end
</pre>
<h3>Designing the controller code</h3>
<p>Now that we&#8217;ve got all the business logic required for saving an uploaded file in the Document class, the actual code for the controller method is pretty simple. All we need to do is check that the document&#8217;s save_upload method is called with the correct parameter.</p>
<pre class="brush: ruby;">
it &quot;should save the uploaded document&quot; do
  document = mock(Document).as_null_object

  Document.should_receive(:new).and_return(document)
  uploaded_file = mock(ActionController::UploadedStringIO).as_null_object
  params = { &quot;id&quot; =&gt; &quot;1&quot;, &quot;document&quot; =&gt; uploaded_file }
  document.should_receive(:save_upload).with(uploaded_file)
  post :save_file, params
end
</pre>
<h3>Implementing the controller code</h3>
<p>Getting this RSpec example to pass is pretty simple. The controller code simply creates a new Document object and then calls the save_upload method with the correct form parameter.</p>
<pre class="brush: ruby;">
  def save_file
    if params[:document] != nil
      document = Document.new
      document.save_upload(params[:document])
    end
  end
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/candidcode.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/candidcode.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/candidcode.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/candidcode.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/candidcode.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/candidcode.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/candidcode.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/candidcode.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/candidcode.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/candidcode.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=31&subd=candidcode&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://candidcode.com/2009/10/20/testing-file-uploads-in-ruby-on-rails-with-rspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686dbb8c68aa12ec355495849d1eeff5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">praveendiangy</media:title>
		</media:content>
	</item>
		<item>
		<title>Sample nginx (with Phusion Passenger) configuration file to enable SSL</title>
		<link>http://candidcode.com/2009/09/12/sample-nginx-with-phusion-passenger-configuration-file-to-enable-ssl/</link>
		<comments>http://candidcode.com/2009/09/12/sample-nginx-with-phusion-passenger-configuration-file-to-enable-ssl/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 20:10:50 +0000</pubDate>
		<dc:creator>praveendiangy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mod_rails]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[phusion passenger]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://candidcode.com/?p=15</guid>
		<description><![CDATA[Read my earlier post if you want Phusion Passenger to compile nginx with SSL support. If your nginx server already supports SSL, read on.
Phusion Passenger fills up most of the configuration in nginx.conf for you with a nice set of defaults. You just have to do a little more work if you want to modify [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=15&subd=candidcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Read my earlier post if you want <a title="Phusion Passenger to compile nginx with SSL support" href="http://candidcode.com/2009/09/12/getting-phusion-passenger-to-install-nginx-with-ssl-support/">Phusion Passenger to compile nginx with SSL support</a>. If your nginx server already supports SSL, read on.</p>
<p>Phusion Passenger fills up most of the configuration in nginx.conf for you with a nice set of defaults. You just have to do a little more work if you want to modify the nginx configuration file to enable SSL on your site.</p>
<p>The first thing to do is purchase a SSL certificate and install it on your server. If you don&#8217;t know how, here&#8217;s a great post on <a title="Installing SSL on Ubuntu with nginx" href="http://open.emspace.com.au/article/installing-ssl-ubuntu-nginx" target="_blank">installing SSL on Ubuntu with nginx</a>. Once you&#8217;ve installed the certificate, you should be good to go.</p>
<p>Let&#8217;s say that you&#8217;ve got a domain name called mydomain.com and the root for your Ruby on Rails application is located at /home/mydomain/current/public on your server. The following shows a sample of the configuration required to get SSL enabled for your application:</p>
<pre class="brush: bash;">
server  {
    	       listen 80;
               server_name mydomain.com;
               root /home/mydomain/current/public;
               passenger_enabled on;
               rails_env production;
        }

# HTTPS server
server  {
               listen 443;
               server_name mydomain.com;
               root /home/mydomain/current/public;
               passenger_enabled on;
               rails_env production;

               ssl on;
               ssl_certificate /etc/ssl/certs/mydomain.com.crt;
               ssl_certificate_key /etc/ssl/private/mydomain.com.key;

               ssl_session_timeout  5m;
        }
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/candidcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/candidcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/candidcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/candidcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/candidcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/candidcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/candidcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/candidcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/candidcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/candidcode.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=15&subd=candidcode&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://candidcode.com/2009/09/12/sample-nginx-with-phusion-passenger-configuration-file-to-enable-ssl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686dbb8c68aa12ec355495849d1eeff5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">praveendiangy</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting Phusion Passenger to install nginx with SSL support</title>
		<link>http://candidcode.com/2009/09/12/getting-phusion-passenger-to-install-nginx-with-ssl-support/</link>
		<comments>http://candidcode.com/2009/09/12/getting-phusion-passenger-to-install-nginx-with-ssl-support/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 17:15:27 +0000</pubDate>
		<dc:creator>praveendiangy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mod_rails]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[phusion passenger]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://candidcode.com/?p=3</guid>
		<description><![CDATA[Phusion Passenger or mod_rails has taken away almost all the pain once associated with deploying Ruby on Rails applications. Phusion Passenger recently added support for the nginx web server.  My application required SSL support, but Phusion Passenger does not by default compile nginx with SSL support. I&#8217;m new to System Administration and even newer to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=3&subd=candidcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a title="Phusion Passenger" href="http://www.modrails.com" target="_blank">Phusion Passenger or mod_rails</a> has taken away almost all the pain once associated with deploying Ruby on Rails applications. Phusion Passenger recently <a title="Support for nginx in Phusion Passenger" href="http://blog.phusion.nl/2009/04/16/phusions-one-year-anniversary-gift-phusion-passenger-220/" target="_blank">added support for the nginx web server</a>.  My application required SSL support, but Phusion Passenger does not by default compile nginx with SSL support. I&#8217;m new to System Administration and even newer to Unix, having used Windows Servers all my life, so I decided to document my steps to make it easier for others with the same problem.</p>
<h3>Step 1: Download and unzip the source code for OpenSSL</h3>
<p>Make sure to visit <a title="OpenSSL Source" href="http://www.openssl.org/source/" target="_blank">OpenSSL</a> to determine the name of the latest source code tarball to download. In my case it was openssl-1.0.0-beta3.tar.gz</p>
<pre class="brush: bash;">
cd /tmp
wget http://www.openssl.org/source/openssl-1.0.0-beta3.tar.gz
tar -xvzf openssl-1.0.0-beta3.tar.gz
</pre>
<h3>Step 2: Download and unzip the source code for nginx</h3>
<p>Make sure to visit nginx to determine the name of the latest source code tarball to download. In my case it was nginx-0.8.14.tar.gz</p>
<pre class="brush: bash;">
wget http://sysoev.ru/nginx/nginx-0.8.14.tar.gz
tar zxf nginx-0.8.14.tar.gz
</pre>
<h3>Step 3:Install and run Phusion Passenger</h3>
<pre class="brush: bash;">
gem install passenger
passenger-install-nginx-module
</pre>
<ul>
<li>Watch Phusion Passenger do its thing and when it asks you &#8220;Automatically download and install Nginx?&#8221;, answer 2</li>
<li>Specify the directory where you unzipped the nginx source code (/tmp/nginx-0.8.14 in my case)</li>
<li>Specify the directory where you want to install nginx to (/opt/nginx in my case)</li>
<li>When asked &#8220;Extra arguments to pass to configure script:&#8221;, reply with:</li>
</ul>
<pre class="brush: bash;">
--with-http_ssl_module --with-openssl=/tmp/openssl-1.0.0-beta3
</pre>
<p>Keep in mind that if you downloaded the latest version of the source code, your values might be slightly different from mine.</p>
<p>That&#8217;s it! I&#8217;ve also posted a <a title="Sample configuration file for nginx to enable SSL" href="http://candidcode.com/2009/09/12/sample-nginx-with-phusion-passenger-configuration-file-to-enable-ssl/">sample configuration file for nginx to enable SSL</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/candidcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/candidcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/candidcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/candidcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/candidcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/candidcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/candidcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/candidcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/candidcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/candidcode.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=candidcode.com&blog=9450965&post=3&subd=candidcode&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://candidcode.com/2009/09/12/getting-phusion-passenger-to-install-nginx-with-ssl-support/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686dbb8c68aa12ec355495849d1eeff5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">praveendiangy</media:title>
		</media:content>
	</item>
	</channel>
</rss>