[section_title title=”Final Changes”]

Now if you go to your site, you will notice no change. That is because we have to point the ~/public_html folder to the correct location. So, let’s do that. On the Site5 server, run the following commands:

mv ~/public_html ~/original_public_html
ln -s ~/apps/bit_gurus/current/public/ ~/public_html

Let’s change our application to use FastCGI. The cool thing about how the application is now setup is that you can actually change stuff in the production environment and commit them to the repository. This is because the production directory is a checked-out version of the last revision at the time of deployment; instead of an exported version. This is great because now you don’t have to worry about missing to propagate any changes that you might have made directly in production.

Anyways, back to what we were doing: setting FastCGI. Go to your application directory on the remote server and change the line in public/.htaccess that is RewriteRule ^(.*)$ dispatch.cgi [QSA,L] to: RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] (note the .fcgi instead of .cgi).

Now if you go to your site, it will be served by FastCGI. A few more steps and we will be done. Let’s see what changes we have made to production so far.

-bash-3.00$ svn status
?      public/system
M      public/.htaccess
-bash-3.00$

.htaccess is the only change that we care about. If you care, you can also set the ‘svn:ignore’ property on ‘public’ directory so system directory doesn’t show up since normally we won’t be worrying about that. You can look at this Rails wiki post if you are really picky about the directories that you ignore.

Let’s commit this change.

svn commit -m "Updated .htaccess to use FastCGI" 

Finally, you can update your local development code by running svn update.

From here on you can change do your development on the development machine and when you are done, commit to the repository and run cap deploy.

There you have it: an almost complete Capistrano guide.