<?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>C3M DIGITAL</title>
	<atom:link href="http://c3mdigital.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://c3mdigital.com</link>
	<description>WordPress Consulting and Development</description>
	<lastBuildDate>Sun, 20 Jan 2013 19:54:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>WordCamp Phoenix 2013</title>
		<link>http://c3mdigital.com/wordcamp-phoenix-2013/</link>
		<comments>http://c3mdigital.com/wordcamp-phoenix-2013/#comments</comments>
		<pubDate>Sun, 20 Jan 2013 19:44:58 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[WordCamp]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1847</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/wordcamp-phoenix-2013/">WordCamp Phoenix 2013</a> </p><p>Tools for Inspecting and Debugging, WordCamp Phoenix 2013 from Chris Olbekson Thanks to all those that attended my WordCamp Phoenix session on Tools for Inspecting and Development. Please feel free to comment or ask any questions. These are the same tools I use in my everyday work writing and testing code.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/wordcamp-phoenix-2013/">WordCamp Phoenix 2013</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/wordcamp-phoenix-2013/">WordCamp Phoenix 2013</a> </p><p><iframe src="http://www.slideshare.net/slideshow/embed_code/16085250" width="427" height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>
<div style="margin-bottom:5px"> <strong> <a href="http://www.slideshare.net/c3mdigital/tools-for-inspecting-and-debugging-wordcamp-phoenix-2013" title="Tools for Inspecting and Debugging, WordCamp Phoenix 2013" target="_blank">Tools for Inspecting and Debugging, WordCamp Phoenix 2013</a> </strong> from <strong><a href="http://www.slideshare.net/c3mdigital" target="_blank">Chris Olbekson</a></strong> </div>
<p>Thanks to all those that attended my WordCamp Phoenix session on Tools for Inspecting and Development.  Please feel free to comment or ask any questions.  These are the same tools I use in my everyday work writing and testing code.</p>
<p>Your just finished reading <a href="http://c3mdigital.com/wordcamp-phoenix-2013/">WordCamp Phoenix 2013</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/wordcamp-phoenix-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whats new in WordPress 3.4</title>
		<link>http://c3mdigital.com/whats-new-in-wordpress-3-4/</link>
		<comments>http://c3mdigital.com/whats-new-in-wordpress-3-4/#comments</comments>
		<pubDate>Thu, 07 Jun 2012 04:07:12 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1639</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/whats-new-in-wordpress-3-4/">Whats new in WordPress 3.4</a> </p><p>WordPress 3.4 will be out any time now and brings some significant changes including some tweaks to WP_Query to make things run faster behind the scenes, and a new theme customizer. Take a look at this video from the folks over at WP101, who produce a nice line of WordPress Tutorial Videos For Developers Nacin&#8217;s [...]</p></p><p>Your just finished reading <a href="http://c3mdigital.com/whats-new-in-wordpress-3-4/">Whats new in WordPress 3.4</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/whats-new-in-wordpress-3-4/">Whats new in WordPress 3.4</a> </p><p>WordPress 3.4 will be out any time now and brings some significant changes including some tweaks to WP_Query to make things run faster behind the scenes, and a new theme customizer.  Take a look at this video from the folks over at <a href="http://www.wp101.com/2012/whats-new-in-wordpress-3-4/">WP101, who produce a nice line of WordPress Tutorial Videos</a></p>
<style>
iframe.video{
background: 
#002B36;
padding: 10px;
border-radius: 8px;
}
</style>
<p><iframe class="video" src="http://player.vimeo.com/video/43566362?title=0&amp;byline=0&amp;portrait=0&amp;color=002D38" width="560" height="315" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<h3>For Developers</3></p>
<p><a href="http://wpdevel.wordpress.com/2012/06/07/wordpress-3-4-field-guide-for-developers/">Nacin&#8217;s WordPress 3.4 field guide for developers</a></p>
<p><a href="http://make.wordpress.org/themes/2012/04/06/updating-custom-backgrounds-and-custom-headers-for-wordpress-3-4/">Chip Bennett explains the new themes <abbr title="Application Programming Interface">API</abbr></a></p>
<h3>Embedded Tweets</h3>
<p>You can now directly embed tweets by just adding the url of the tweet directly into the WordPress post editor.</p>
<blockquote class="twitter-tweet" width="550"><p>WordPress 3.4 is here! Update your site now to try the new theme customizer, better headers, HTML captions &amp; more: <a href="http://t.co/tHpz0Mau" title="http://wp.me/pZhYe-BE">wp.me/pZhYe-BE</a></p>
<p>&mdash; WordPress(@WordPress) <a href="https://twitter.com/WordPress/status/212978388133085185" data-datetime="2012-06-13T18:42:59+00:00">June 13, 2012</a></p></blockquote>
<p><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>Your just finished reading <a href="http://c3mdigital.com/whats-new-in-wordpress-3-4/">Whats new in WordPress 3.4</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/whats-new-in-wordpress-3-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip &#8211; Work on Local Files with Diet Coda</title>
		<link>http://c3mdigital.com/local-files-diet-coda/</link>
		<comments>http://c3mdigital.com/local-files-diet-coda/#comments</comments>
		<pubDate>Mon, 28 May 2012 07:51:09 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Development Tools]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1540</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/local-files-diet-coda/">Quick Tip &#8211; Work on Local Files with Diet Coda</a> </p><p>How to use Panic's new iPad app, Diet Coda, to work on local files.  Panic states that you can use it on your staging or dev server but most people use their local machine as their dev server.  From reading reviews this seems like the biggest complaint about the app.  Using OS X's built in ssh server you can access your local files and edit them directly in Diet Coda.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/local-files-diet-coda/">Quick Tip &#8211; Work on Local Files with Diet Coda</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/local-files-diet-coda/">Quick Tip &#8211; Work on Local Files with Diet Coda</a> </p><p>I was very excited when I heard Panic was releasing a new iPad app, <a href="http://panic.com/dietcoda/">Diet Coda</a> to go along with the release of the updated <a href="http://panic.com/coda/">Coda 2 editor</a>.</p>
<p>One thing that I don&#8217;t like about the app is that it encourages <a href="http://www.bnj.com/cowboy-coding-pink-sombrero/">Cowboy Coding</a>, the practice of editing files on a live server. Panic states that you can use it on your staging or dev server but most people use their local machine as their dev server. From reading reviews this seems like the biggest complaint people have about the app.</p>
<p>Even though it&#8217;s not documented anywhere you can actually use this app to work on files saved on your Mac. OS X comes with a built-in ssh server which allows you to connect using SFTP. You will need to enable Remote Login in your sharing settings on your Mac first.</p>
<p><img class="aligncenter size-full wp-image-1559" title="Diet Coda Local File Editing Screenshot 4" alt="" src="http://i1.wp.com/c3mdigital.com/files/2012/05/diet-coda-screenshot-4.png?resize=560%2C464" data-recalc-dims="1" /></p>
<p>Enter the IP address from above into Diet Coda&#8217;s site settings.<br />
To do this just enter your Mac&#8217;s local IP address into the site Settings in Diet Coda. Once it connects you will be able to access any file on your computer and edit it in Diet Coda.</p>
<h3>Diet Coda Screenshots &#8211; Working with local files</h3>
<p><img class="aligncenter size-full wp-image-1544" title="Diet Coda Local Files Screenshot" alt="" src="http://i2.wp.com/c3mdigital.com/files/2012/05/diet-coda-screenshot1.png?resize=560%2C656" data-recalc-dims="1" /><br />
<img class="aligncenter size-full wp-image-1543" title="Diet Coda Local Files Screenshot" alt="" src="http://i2.wp.com/c3mdigital.com/files/2012/05/diet-coda-screenshot3.png?resize=560%2C308" data-recalc-dims="1" /><br />
<img class="aligncenter size-full wp-image-1542" title="Diet Coda Local Files Screenshot" alt="" src="http://i1.wp.com/c3mdigital.com/files/2012/05/diet-coda-screenshot2.png?resize=560%2C378" data-recalc-dims="1" /></p>
<p>Your just finished reading <a href="http://c3mdigital.com/local-files-diet-coda/">Quick Tip &#8211; Work on Local Files with Diet Coda</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/local-files-diet-coda/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Get latest 3 posts from multiple custom post types in one query</title>
		<link>http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/</link>
		<comments>http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/#comments</comments>
		<pubDate>Fri, 11 May 2012 22:19:03 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Code Snippits]]></category>
		<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1461</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/">Get latest 3 posts from multiple custom post types in one query</a> </p><p>This method uses a counter and 1 query to return the latest 3 posts from multiple custom post types.  This might not be the best solution if you have a really large amount of posts because it will loop through all the posts and if the count is higher than 3 for the given post type it will go back to the beginning of the loop.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/">Get latest 3 posts from multiple custom post types in one query</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/">Get latest 3 posts from multiple custom post types in one query</a> </p><p><script src="https://gist.github.com/2662723.js?file=multiple-post-query.php"></script></p>
<p>Your just finished reading <a href="http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/">Get latest 3 posts from multiple custom post types in one query</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/get-latest-3-posts-from-multiple-custom-post-types-in-one-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Austin &#8211; I&#8217;m Speaking</title>
		<link>http://c3mdigital.com/wordcamp-austin-im-speaking/</link>
		<comments>http://c3mdigital.com/wordcamp-austin-im-speaking/#comments</comments>
		<pubDate>Tue, 08 May 2012 16:24:34 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Community Support]]></category>
		<category><![CDATA[WordCamp]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1449</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/wordcamp-austin-im-speaking/">WordCamp Austin &#8211; I&#8217;m Speaking</a> </p><p>I'll be <a href="http://2012.austin.wordcamp.org/speakers/">speaking at WordCamp Austin</a> later this month.  My session is "The Query, the Whole Query, and nothing but the Query".  It will include everything you need to know about the WP_Query class and how to properly query the WordPress database for posts.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/wordcamp-austin-im-speaking/">WordCamp Austin &#8211; I&#8217;m Speaking</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/wordcamp-austin-im-speaking/">WordCamp Austin &#8211; I&#8217;m Speaking</a> </p><p><img class="alignleft size-thumbnail wp-image-1450" title="austin-wordcamp-2012-stamp" src="http://i0.wp.com/c3mdigital.com/files/2012/05/austin-wordcamp-2012-stamp-e1337451406816-150x150.png?resize=150%2C150" alt="" data-recalc-dims="1" /> I&#8217;ll be <a href="http://2012.austin.wordcamp.org/speakers/">speaking at WordCamp Austin</a> later this month. My session is &#8220;The Query, the Whole Query, and nothing but the Query&#8221;. It will include everything you need to know about the WP_Query class and how to properly query the WordPress database for posts. I look forward to meeting some new people and seeing old friends. I&#8217;ll be updating this post with slides and additional code samples. Please comment if you have any questions or suggestions.</p>
<div id="__ss_12994615" style="width: 552px;"><strong style="display: block; margin: 12px 0 4px;"><a title="The Query the Whole Query and Nothing but the Query" href="http://www.slideshare.net/c3mdigital/the-query-the-whole-query-and-nothing-but-the-query">The Query the Whole Query and Nothing but the Query</a></strong><object id="__sse12994615" width="552" height="461" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=thequerythewholequery-120519130811-phpapp01&amp;stripped_title=the-query-the-whole-query-and-nothing-but-the-query&amp;userName=c3mdigital" /><param name="allowscriptaccess" value="always" /><param name="allowfullscreen" value="true" /><embed id="__sse12994615" width="552" height="461" type="application/x-shockwave-flash" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=thequerythewholequery-120519130811-phpapp01&amp;stripped_title=the-query-the-whole-query-and-nothing-but-the-query&amp;userName=c3mdigital" allowFullScreen="true" allowScriptAccess="always" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" /></object></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/c3mdigital">Chris Olbekson</a>.</div>
</div>
<p>Your just finished reading <a href="http://c3mdigital.com/wordcamp-austin-im-speaking/">WordCamp Austin &#8211; I&#8217;m Speaking</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/wordcamp-austin-im-speaking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Git to your WordPress development workflow &#8211; an introduction</title>
		<link>http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/</link>
		<comments>http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 07:37:15 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1326</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/">Adding Git to your WordPress development workflow &#8211; an introduction</a> </p><p>The purpose of this guide is to show you how you can add Git to your WordPress development workflow and will include the basics of securely installing Git on a remote server, using your local machine for development and deploying your changes to a live production server using SSH.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/">Adding Git to your WordPress development workflow &#8211; an introduction</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/">Adding Git to your WordPress development workflow &#8211; an introduction</a> </p><p>WordPress lead developer, Mark Jaquith, recently gave a talk at WordCamp San Francisco on&nbsp;<strong>Scaling, Servers, and Deploys </strong>that including some great advice on professional WordPress development using Git. &nbsp;Git is a&nbsp;<strong>free &amp; open source, distributed version control system</strong>&nbsp;designed to handle everything from small to very large projects with speed and efficiency.</p>
<p><strong>The session from WordCamp San Francisco:</strong><br />
<embed type="application/x-shockwave-flash" src="http://s0.videopress.com/player.swf?v=1.03" width="600" height="340" wmode="direct" seamlesstabbing="true" allowfullscreen="true" allowscriptaccess="always" overstretch="true" flashvars="guid=LqJ002Pq&amp;isDynamicSeeking=true"></embed></p>
<p>The purpose of this guide is to show you how you can add Git to your WordPress development workflow and will include the basics of securely installing Git on a remote server, using your local machine for development and deploying your changes to a live production server using SSH.</p>
<p>This article assumes:</p>
<ul>
<li>You have SSH access to a remote server running Debian or Ubuntu (The shell commands will be slightly different for other distros)</li>
<li>Your using a Mac with a local development environment already set up.</li>
<li>Your comfortable using the command line and able to access your remote server using SSH keys.</li>
</ul>
<p><strong>Step 1: Installing Git on the remote server</strong></p>
<p>Install Git:</p>
<pre class="brush: plain; title: ; notranslate">

apt-get install git-core

</pre>
<p>Adding the git user.  (You will be asked to enter a password for the git user.  We won&#8217;t be using it but remember what it is just in case.)</p>
<pre class="brush: plain; title: ; notranslate">

adduser git

</pre>
<p>Setup SSH keys for the new git user.  If you still have access to the public key you use to access your server you can add it to /home/git/.ssh/authorized_keys. If not you will need to generate a new public/private key pair and add the public key to your server. See my previous article <a href="http://c3mdigital.com/2011/07/22/wordpress-performance-server/3/">WordPress Performance Server – Debian “squeeze” with Nginx, APC and PHP from the Dotdeb repos</a> for more info on setting up SSH keys on your server.  You can also use the ssh-keygen tutorial on <a href="http://help.github.com/mac-set-up-git/">GitHub</a>.</p>
<pre class="brush: plain; title: ; notranslate">
su git
cd /home/git
mkdir .ssh
chmod 700 .ssh
cd .ssh
touch authorized_keys
cat id_dsa.pub &gt;&gt; authorized_keys
exit
</pre>
<p>If you need to switch back to your normal user to add your public key make sure you chown the /home/git/.ssh back to the git user by running:
<pre class="brush: plain; title: ; notranslate">chown git:git /home/git/ -R</pre>
<p>Now lets test our SSH connection using the git username on the remote server.  If you use lots of different SSH keys for different servers it helps if you add instructions to your config file to identify the right key to use when logging in.</p>
<p>On your local machine create if needed and open the file ~/.ssh/config</p>
<pre class="brush: plain; title: ; notranslate">
Host remote_server_domain.com
Hostname remote_server_domain.com
IdentityFile ~/.ssh/id_dsa //Your private key that matches the public key we installed on the server
User git
</pre>
<p>Now lets test our connection to the remote server</p>
<pre class="brush: plain; title: ; notranslate">
ssh git@remote_server_domain.com
</pre>
<p>If your able to connect let&#8217;s go ahead and create and initialize our remote Git repository. We&#8217;re calling this repo &#8220;project1&#8243;.</p>
<pre class="brush: plain; title: ; notranslate">
cd /home/git
mkdir project1
cd project1
git --bare init
exit
</pre>
<p>You just created your first remote Git repository!</p>
<p>For security we are going to restrict shell access for the git user.  This will allow you to share development with other users by giving them SSH access to the repo without giving them shell access to your server.<br />
SSH back into your server with the user with su privileges.</p>
<pre class="brush: plain; title: ; notranslate"> 
nano /etc/passwd
</pre>
<p>When you open the file find the line for the new git user we just added and change the end of the line from /bin/bash to /usr/bin/git-shell. (Do not change the user Id or group ID).  It should look like this when your done:</p>
<pre class="brush: plain; title: ; notranslate">
git:x:1001:1001:Git,,,:/home/git:/usr/bin/git-shell
</pre>
<p>Test the new config by exiting and trying again to SSH into the server with the git user:</p>
<pre class="brush: plain; title: ; notranslate">
ssh git@remote_server_domain.com

fatal: What do you think I am? A shell?
connection to [remote_server_domain.com] closed.
</pre>
<p>Now we have a secure remote repository.</p>
<p><strong>Step 2: Installing Git and setting up your local machine</strong></p>
<p><a href="http://code.google.com/p/git-osx-installer/downloads/list?can=3">Download and install the latest version for Mac </a>(For Lion or Snow Leopard choose: Git Installer 1.7.6 &#8211; OS X &#8211; Snow Leopard &#8211; x86_64)</p>
<p><strong>Making your first commit.</strong><br />
Now that we have our remote repo setup and Git installed on our local machine let&#8217;s make our first commit.</p>
<pre class="brush: plain; title: ; notranslate">
mkdir project1
cd project1
git init
touch readme.txt
git add .
git commit -m &quot;Initial commit - added readme.txt&quot;
</pre>
<p>The first time we use our new repo we need to tell Git where to find it.</p>
<pre class="brush: plain; title: ; notranslate">
git remote add origin ssh://git@remote_server_domain.com/home/git/project1
git push origin master
</pre>
<p>Now we are going to delete the project1 directory we created on our local machine and check out the repo so we can start doing some WordPress development. I use the ~/sites directory for my local development so lets check the new project out into that directory. If you haven&#8217;t set up your local environment using hostname aliases in the ~/sites directory check out this tutorial on WPCandy: <a href="http://wpcandy.com/teaches/how-to-improve-local-wordpress-development-on-a-mac">How to improve local WordPress development on a Mac</a></p>
<pre class="brush: plain; title: ; notranslate">
rm -rf project1
mkdir ~/sites/wp.dev
cd wp.dev
git clone ssh://git@remote_server_domain.com/home/git/project1
</pre>
<p>We now have checked out the latest version of our repo (currently only containing the readme.txt file) and are ready to start working but first we need to decide our version control strategy.</p>
<h3>Setting up your repo for WordPress theme and plugin development</h3>
<p>The power of Git besides being able to track your development changes is being able to quickly deploy a complete site to your production server including the latest version of WordPress. The WordPress team uses Subversion to track WordPress core changes but luckily there is a <a href="https://github.com/markjaquith/WordPress">Git WordPress clone</a> that updates every 30 minutes.</p>
<p>There are couple different routes you can take when setting up your repo with WordPress. Some developers prefer to keep the wp-content directory under version control separate from the core files then sym link to the version controlled wp-content dir that contains your theme and or plugin files that you will be working on. </p>
<p>Keeping things separate is probably best if you want to use one master repo for all the themes and plugins you work on but for this article we are going to clone the 3.2 branch from the WordPress Git repo and merge it with our remote repo. This will make it easier to deploy until we master more advanced deploy techniques like using <a href="https://github.com/capistrano/capistrano/wiki">Capistrano</a> to automate the deploy process.</p>
<p>The git pull command allows us to clone the WordPress repo and merge it with our remote repo with one command.  We can also specify the branch (currently WordPress is on 3.2-branch) we want to work with.</p>
<pre class="brush: plain; title: ; notranslate">
cd ~/sites/wp.dev
git pull https://github.com/markjaquith/WordPress.git 3.2-branch
git add .
git commit -m &quot;added WordPress core files&quot;
</pre>
<p>You will notice that when you try to make this commit you will get a message that your branch is ahead of origin/master</p>
<pre class="brush: plain; title: ; notranslate">
# On branch master
# Your branch is ahead of 'origin/master' by 16688 commits.
#
nothing to commit (working directory clean)
</pre>
<p>There might be a better way to add WordPress and keep it under version control but using this method we inherit all the core svn commits that were made to the 3.2-branch (Don&#8217;t worry any new additions will not cause problems)</p>
<p>Now that we have the WordPress core files in our repo lets go ahead and push them to our remote master</p>
<pre class="brush: plain; title: ; notranslate">
git push origin master
</pre>
<p>Before we start working we need to make a few changes to wp-config.php to use the local version of our database by creating a local-config.php file.  (See Mark Jaquith&#8217;s post<a href="http://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/">WordPress local dev tips: DB &#038; plugins</a> for detailed instructions on how to use a local-config.php file and disable plugins you don&#8217;t want to run on your local environment.</p>
<p>We want to keep wp-config.php under version control but tell WordPress to use our local DB_NAME, DB_USER, and DB_PASSWORD settings when we&#8217;re doing local development.</p>
<p>You can now create your theme or plugin files and start working and commit (check them in) as needed:</p>
<pre class="brush: plain; title: ; notranslate">
git add .
git commit -m &quot;Your commit message&quot;
git push origin master
</pre>
<h3>Step 4: Deploying to a live server</h3>
<p>For this article I&#8217;m going to cover a very basic deploy strategy that uses the master and origin branches.  There are more advanced methods like <a href="http://help.github.com/deploy-with-capistrano/">Capistrano</a> and multiple branches for staging and production that I will cover in future articles. See the <a href="http://gitref.org/branching/#branch">Git Reference</a> for more info on working with branches.</p>
<p>Moving to our live server were going to clone repo.  This assumes the production environment lives on the same server as the remote repo or we have generated a working SSH key pair to access the remote repo.</p>
<pre class="brush: plain; title: ; notranslate">

cd {root public dir}
git clone ssh://git@remote_server_domain.com/home/git/project1 .
</pre>
<p>Now anytime you make updates SSH into the live server and run:</p>
<pre class="brush: plain; title: ; notranslate">
git fetch origin
git merge origin master
</pre>
<p>If you ever need to rollback a change you can quickly do a git reset &#8211;hard your_sha.  Your_sha represents a commit and to find the previous commit to roll back from run git log. This will output recent changes.  Find the most recent &#8220;Merge remote branch&#8221; message and use the sha (long number after the commit message) to run your git reset command.</p>
<p><strong>Conclusion</strong><br />
Hopefully this article gives you a basic understanding of how version control with Git works. This should give you a good start and keep you from wearing the &#8220;<a href="http://www.bnj.com/cowboy-coding-pink-sombrero/">Pink Sombrero</a>&#8221; I would love to hear how you use version control in your WordPress development workflow and welcome any comments or suggestions.</p>
<p><strong>Resources used for this article:</strong></p>
<ul>
<li><a href="http://help.github.com/">Help.GitHub.com</a></li>
<li>Mark on WordPress: <a href="http://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/">WordPress local dev tips DB &#038; Plugins</a></li>
<li>Clint Berry: <a href="http://clintberry.com/2011/07/speed-up-your-wordpress-development-cycle-with-git/">Speed Up Your WordPress Development Cycle with Git</a></li>
<li>WordPress.Stackexchange.com: <a href="http://wordpress.stackexchange.com/q/218/251">Getting Started with Subversion, Git, or similar Version Control System to keep a History of my Files?</a></li>
</ul>
<p>Your just finished reading <a href="http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/">Adding Git to your WordPress development workflow &#8211; an introduction</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/adding-git-to-your-wordpress-development-workflow/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>WordPress Performance Server &#8211; Debian “squeeze” with Nginx, APC and PHP from the Dotdeb repos</title>
		<link>http://c3mdigital.com/wordpress-performance-server/</link>
		<comments>http://c3mdigital.com/wordpress-performance-server/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 09:43:01 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1194</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/wordpress-performance-server/">WordPress Performance Server &#8211; Debian “squeeze” with Nginx, APC and PHP from the Dotdeb repos</a> </p><p>Step by step guide on how to set up your own unmanaged server or vps to run as a WordPress Performance server environment. &#160;Using this setup you will have the ability to host a large WordPress Multisite set up or numerous single installs.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/wordpress-performance-server/">WordPress Performance Server &#8211; Debian “squeeze” with Nginx, APC and PHP from the Dotdeb repos</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/wordpress-performance-server/">WordPress Performance Server &#8211; Debian “squeeze” with Nginx, APC and PHP from the Dotdeb repos</a> </p><p><a href="http://i2.wp.com/c3mdigital.com/files/2011/07/nginx-wordpress1-300x84-copy.png"><img class="size-full wp-image-1359 aligncenter" title="nginx-wordpress1-300x84 copy" src="http://i2.wp.com/c3mdigital.com/files/2011/07/nginx-wordpress1-300x84-copy.png?resize=300%2C84" alt="" data-recalc-dims="1" /></a></p>
<p>This is a step by step guide on how to set up your own unmanaged server or vps to run as a WordPress Performance server environment.  Using this setup you will have the ability to host a large WordPress Multisite set up or numerous single installs.  This guide assumes you have a basic understanding of using SSH via the Mac Terminal app or Putty for Windows and requires an unmanaged dedicated server or VPS hosting account with either the 32 or 64 bit Debian kernal available.</p>
<p>In my last guide I touted a <a href="http://wp-performance.com/2010/10/nginx-reverse-proxy-cache-wordpress-apache/">Nginx reverse proxy cache with WordPress and Apache</a> as the ultimate WordPress performance stack but since then I have found that there is really no reason to use Apache unless you have a specific need for it.  Nginx has matured and works great with the WordPress rewrite engine and even W3 Total Cache now includes Nginx rewrite rules for page cache, minify and browser caching.</p>
<p>If you ever decide that managing you own web server isn&#8217;t for you then I highly recommend <a href="http://www.shareasale.com/r.cfm?b=398775&#038;u=682347&#038;m=41388&#038;urllink=&#038;afftrack=">WP Engine WordPress Hosting</a>  WP Engine runs on Nginx and they handle all the caching for you.   </p>
<h3>Choosing a web host with Debian &#8220;squeeze&#8221; images available</h3>
<p><a href="http://www.debian.org/releases/stable/">Debian 6 aka &#8220;squeeze&#8221;</a> is considered the grandfather of Linux distors and Debian is known for relatively strict adherence to the <a title="Unix philosophy" href="http://en.wikipedia.org/wiki/Unix_philosophy">Unix</a> and <a title="Free software" href="http://en.wikipedia.org/wiki/Free_software">free software</a> philosophies.  Debian is also distributed with access to repositories containing thousands of software packages ready for installation and use.</p>
<p>Most of the large <a href="http://bit.ly/c3mGator">managed hosting companies</a> don&#8217;t give you the option of choosing your Linux distro so your going to need to find one that does.  The reason for this is that it&#8217;s much easier for a hosting company to provide support using cPanel or <a href="http://www.parallels.com/products/pvc46/">Parallels Virtuozzo</a> VPS virtualization.  Virtuozzo allows them to squeeze many more VPSs on a box and control the resources and your limited to guess what &#8211; Cent OS.</p>
<p>Your going to need a provider that offers <a href="http://xen.org/">Xen virtualization</a>.  Xen is a powerful open source virtualization platform that supports a wide range of guest operating systems including Linux &#8211; Debian, Ubuntu, Free BSD, Cent OS, Fedora and more.  When you set up your account have your provider load the <a href="http://www.debian.org/releases/stable/">Debian 6 aka &#8220;squeeze&#8221;</a> image on your VPS or install it on your dedicated server.  If you have over 2GB memory go for the 64 bit version.</p>
<p>I use <a href="http://www.softlayer.com/">Softlayer (formally The Planet)</a> for my dedicated server because of the state of the art data centers and major broadband backbone it&#8217;s connected to.  It also has a very powerful back end portal and allows you to connect to your box over a private VPN.  <a href="http://www.linode.com/">Linode</a>, <a href="http://www.slicehost.com/">Slicehost</a>, and <a href="http://www.vps.net/">VPS.net</a>  are also very good choices.  I would stay away from Media Temple and Rackspace as I&#8217;ve had problems with both and they&#8217;ve had well documented  <a href="http://michaeltorbert.com/blog/media-temple-hacked/">security vulnerabilities</a> in the past.</p>
<p>Your provider will either provide you with an ip address and password to connect to your server for the first time or give you access to a control panel that you can use to load the image.</p>
<p>Some hosts include the network setup on the image others provide a java ssh console to connect.  If your only provided the java console you will need to set up the networking settings.</p>
<p><em>*Note: all entries in this article that require opening a file assume the <a href="http://www.nano-editor.org/">nano text editor</a>, some of you  might prefer <a href="http://www.vim.org/">vim</a> or if your a real Linux Ninja<a href="http://www.gnu.org/software/emacs/"> Emacs</a> (If you use Emacs you don&#8217;t need to read this article .)  If you prefer vim just substitue vi for nano.</em></p>
<p>If your provider pre-installed the image for you skip to Security.</p>
<pre class="brush: plain; title: ; notranslate">
nano /etc/network/interfaces
</pre>
<p>This is the file that contains the connection settings for each of the network cards on your server.  You will need your ip address and the gateway address which is to the router.  Your host should provide these for you.</p>
<pre class="brush: plain; title: ; notranslate">
auto lo
iface lo inet loopback
auto eth0 inet static
address xx.xx.xxx.xxx
netmask 255.255.255.0
gateway xx.xx.xxx.xxx
</pre>
<p><em>Ctrl-x will close your file and prompt you to save.</em></p>
<p><a class="selector" href="http://i2.wp.com/c3mdigital.com/files/2011/07/chris-—-ssh-—-66×39.png"><img class="aligncenter size-large wp-image-1203" title="Network Interfaces Terminal Window" src="http://i2.wp.com/c3mdigital.com/files/2011/07/chris-—-ssh-—-66×39.png?resize=580%2C633" alt="" data-recalc-dims="1" /></a></p>
<p>Next we will install the secure shell server</p>
<pre class="brush: plain; title: ; notranslate">
apt-get install openssh-server
/etc/init.d/ssh status
: sshd is running.
</pre>
<p>With networking and ssh setup you will be able to connect via ssh using Terminal or Putty</p>
<pre class="brush: plain; title: ; notranslate">
ssh root@xxx.xx.xx.xx
</pre>
<p>Enter your password at the prompt and accept the key fingerprint prompt which will add your new server or vps to your local known_hosts file.</p>
<h3>Securing your server</h3>
<p>The first step is securing your server.  To properly secure your server you need to disable password auth and use ssh keys to access your server.  Your key authorization will also be used for adding files via an SFTP program like Transmit.  We will also be updating all the packages and configuring the firewall using ufw.</p>
<pre class="brush: plain; title: ; notranslate">
apt-get update
apt-get upgrade-distro
</pre>
<p>Disable password authentication  in the sshd_config file.</p>
<pre class="brush: plain; title: ; notranslate">
nano /etc/ssh/sshd_config
Protocol 2
PasswordAuthentication no
UseDNS no
</pre>
<p>Open another terminal window to generate the ssh keys on your LOCAL machine.</p>
<pre class="brush: plain; title: ; notranslate">
mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa
</pre>
<p>You will be prompted for a password to further secure your key and a name to save it under. Unless you all ready have existing keys just press enter to accept the default name of id_rsa / id_rsa.pub. The id_rsa.pub file is your public key and will need to be moved to the server.</p>
<pre class="brush: plain; title: ; notranslate">
scp ~/.ssh/id_rsa.pub root@xxx.xxx.xx.xx:
</pre>
<p>You will be prompted for your server password and your public key file will be in your root directory. Now will move it to the correct place and add it to the authorized_keys file. Close your 2nd terminal window and go back to the one you were using and connected to the server with.</p>
<pre class="brush: plain; title: ; notranslate">
mkdir ~/.ssh
mv ~/id_rsa.pub ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
</pre>
<p>Now we will configure the firewall using ufw. <a href="https://help.ubuntu.com/community/UFW">UFW</a> is an uncomplicated firewall that acts as an interface to control the servers iptables without the confusing syntax. It is shipped with Ubuntu but for Debian you will need to install: apt-get install ufw.</p>
<p>The following commands will open up the ports for ssh, web, smtp (php-mail), and mysql. You can add rules for any of the network services defined in the /etc/services file or roll your own custom rules.</p>
<pre class="brush: plain; title: ; notranslate">
ufw allow ssh
ufw allow www
ufw allow https
ufw allow mysql
ufw enable
ufw status

:To		Action	From
--		------	----
22		ALLOW	Anywhere
80		ALLOW	Anywhere
443		ALLOW	Anywhere
3306		ALLOW	Anywhere
</pre>
<p>Now we will restart ssh and test our connection. VERY IMPORTANT don&#8217;t disconnect your current ssh session! Test by opening another terminal window. If your on Mac you will get a keychain notice for your key password. Click the remember button so you won&#8217;t have to enter it every time.</p>
<p><em>Current terminal window</em></p>
<pre class="brush: plain; title: ; notranslate">
/etc/init.d/ssh reload
</pre>
<p><em>New Terminal window</em></p>
<pre class="brush: plain; title: ; notranslate">

ssh root@xxx.xxx.xx.xx

:Linux DebianLinux-001 2.6.32-5-amd64 #1 SMP Mon Mar 7 21:35:22 UTC 2011 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jul 12 21:40:45 2011 from 108-71-13-85.lightspeed.hstntx.sbcglobal.net

root@servername ~:
</pre>
<p>If you were successful give your self a pat on the back and close your original terminal window.</p>
<h3>The Performance Stack &#8211; Nginx, PHP-FPM, MySQL</h3>
<p>In the past, with Debian 5, it was very frustrating trying to stay up to date with the latest versions of PHP, MySQL and Nginx because the packages were always so outdated. Debian 6 shipped with up to date versions but if you want the latest performance packages your going to need the <a href="http://www.dotdeb.org/">Dotdeb repositories</a>.</p>
<p>Dotdeb is a repository containing packages to turn your Debian boxes into powerful, stable and up-to-date LAMP servers :</p>
<ul>
<li>PHP 5.3</li>
<li>useful PHP extensions : APC, imagick, Pinba, xcache, Xdebug, XHprof…</li>
<li>MySQL 5.1 and its performant InnoDB plugin,</li>
<li>Maatkit…</li>
</ul>
<p>Add the Dotdeb repos to /etc/apt/sources.list</p>
<pre class="brush: plain; title: ; notranslate">
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
</pre>
<p>Now fetch the appropriate GnuPG keys</p>
<pre class="brush: plain; title: ; notranslate">
wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | apt-key add -
</pre>
<p>Run apt-get update and you should see your server connecting to the dot deb mirrors.</p>
<p><em>Note: Dotdob is a one man operation maintained by Guillaume Plessis, <a href="http://twitter.com/#!/w_a_s_t_e">@W_a_s_t_e</a> on Twitter. If you benefit or prosper from his packages consider <a href="http://www.dotdeb.org/donate/">donating</a> </em></p>
<h3>Install Nginx, PHP-FPM, MySQL, APC</h3>
<pre class="brush: plain; title: ; notranslate">
apt-get install nginx-full php5-fpm php5 php5-mysql php5-apc php5-mysql php5-xsl php5-xmlrpc php5-sqlite php5-snmp php5-curl
</pre>
<p>You will be prompted to accept installs and apt-get will make sure all dependencies are met and install additional packages if needed. When you get to the MySQL install a semi-graphical interface will pop up. Make sure you choose a password for the root mysql user.</p>
<p>If you have made it this far go grab a beer or an espresso you deserve it, Systems Administrator.</p>
<h3>The .conf files &#8211; configuring your web server</h3>
<p>The default .conf files included in the Dotdeb packages will almost work right out of the box. You will need to make a few adjustments.</p>
<p><strong>Nginx and PHP-FPM</strong><br />
Before you set up the Nginx.conf files you need to decide your folder structure and where the root of your websites will live. I like to use /srv/www/sitename/public for the web root and /srv/www/sitename/logs for the error and access logs. The files in your web root need to be owned by the same user as Nginx runs under. The Debian way is to run the server as www-data.</p>
<pre class="brush: plain; title: ; notranslate">
mkdir /srv/www/yoursitename /srv/www/yoursitename/public /srv/www/yoursitename/logs
chown www-data:www-data /srv/www/yoursitename/public/ -R
</pre>
<p><strong>File: /etc/nginx/nginx.conf</strong><br />
<em>Note: be wary of some of the copy and paste guides out there. The Slicehost and Linode tutorials are out of date and contain security vulnerabilities. If you don&#8217;t understand something question it and do your own research. The following files have been tested and are in use on real production servers.</em></p>
<pre class="brush: plain; title: ; notranslate">
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
	worker_connections 1024;
	# multi_accept on;
}

http {
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	server_tokens off;
	include mime.types;
	default_type  application/octet-stream;
	index index.php index.htm index.html redirect.php;

	#Gzip
	gzip  on;
	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_buffers 16 8k;
	gzip_http_version 1.1;
	gzip_disable &quot;MSIE [1-6].(?!.*SV1)&quot;;
	gzip_types text/plain text/css application/json application/x-javascript text/xml
                        application/xml application/xml+rss text/javascript;

	#FastCGI
	fastcgi_intercept_errors on;
	fastcgi_ignore_client_abort on;
	fastcgi_buffers 8 16k;
	fastcgi_buffer_size 32k;
	fastcgi_read_timeout 120;
	fastcgi_index  index.php;

	limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;  #Our individual site vhost server files will live here
}
</pre>
<p>If your familiar with the Apache Vhost concept you will be fine with Nginx. The Nginx server files we create act as individual site vhost.conf files and can either be in one large file or for better organization you can create a separate file for each site. The Debian way is to create 2 directories under /etc/nginx/, sites-available for the files and sites-enabled for sym links pointing to the file in sites-available. This allows you to turn off a site without having to delete it if you ever need it again.</p>
<pre class="brush: plain; title: ; notranslate">
touch /etc/nginx/sites-available/your_domain.com
ln -s /etc/nginx/sites-available/your_domain.com /etc/nginx/sites-enabled/your_domain.com
cd /etc/nginx/sites-enabled
ls -a
:drwxr-xr-x 2 root root 4096 Jun 26 02:04 .
drwxr-xr-x 5 root root 4096 Jun 26 01:50 ..
lrwxrwxrwx 1 root root   40 Jun 26 01:59 your_domain.com -&gt; /etc/nginx/sites-available/your_domain.com
</pre>
<p><strong>File: /etc/nginx/sites-available/your_domain.com</strong><br />
This is for a single WordPress install. We are also including the W3 Total Cache Nginx rewrite rules in a separate file w3-total.conf. You will need to run touch /etc/nginx/w3-total.conf and chown www-data:www-data /etc/nginx/w3-total.conf and list the path in the W3 Total Cache general settings so it can write to the file. <em>*Note: Anytime you make a change to an Nginx server file you will need to restart.</em></p>
<pre class="brush: plain; title: ; notranslate">
server {
	listen 80;

	server_name your_domain.com www.your_domain.com;
	root /srv/www/domain/public;
	access_log /srv/www/domain/logs/access.log;
	error_log /srv/www/domain/logs/error.log;

        client_max_body_size 8M;
        client_body_buffer_size 128k;
        #The section below contains your WordPress rewrite rules
	location / {
                try_files $uri $uri/ /index.php?q=$uri&amp;$args;
	}
        location /search { limit_req zone=one burst=3 nodelay; rewrite ^ /index.php; }
	fastcgi_intercept_errors off;
	location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
		expires max;
		add_header Pragma public;
		add_header Cache-Control &quot;public, must-revalidate, proxy-revalidate&quot;;
	}

#sample 301 redirect
#	location /2011/06/26/permalink/ {
#		rewrite //2011/06/26/permalink/ http://example.com/2011/06/27/permalink_redirecting_to/ permanent;
#		}

#Send the php files to upstream to PHP-FPM
#This can also be added to separate file and added with an include
location ~ \.php {
        try_files $uri =404; #This line closes a big security hole
                             #see: http://forum.nginx.org/read.php?2,88845,page=3
        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  SCRIPT_FILENAME    $document_root$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;

        fastcgi_pass 127.0.0.1:9000;
}

#Once you have your w3-total.conf file ready un-comment out the line below
#include w3-total.conf;
</pre>
<p>You can now start your server and see if it works.</p>
<pre class="brush: plain; title: ; notranslate">
touch /srv/www/yoursite/public/index.php
echo '&lt;!--?php echo &quot;&lt;br ?--&gt;&lt;/pre&gt;
&lt;h1&gt;Nginx Baby - It WORKS!!!!&lt;/h1&gt;
&lt;pre&gt;
&quot;; ?&gt;' &gt;&gt; /srv/www/yoursite/public/index.php
/etc/init.d/nginx start
</pre>
<p>For more Nginx server file examples see the <a href="http://codex.wordpress.org/Nginx">WordPress.org Nginx Codex</a></p>
<p>Open a browser and go to your domain or ip and if you did everything right you should see:<br />
<a class="selector" href="http://i1.wp.com/c3mdigital.com/files/2011/07/http___64.18.223.124_testing.php_.png"><img class="aligncenter size-large wp-image-1211" title="Nginx baby - It Works!!!!" src="http://i1.wp.com/c3mdigital.com/files/2011/07/http___64.18.223.124_testing.php_.png?resize=580%2C424" alt="" data-recalc-dims="1" /></a></p>
<p><strong>WordPress Multisite, alternative configuration and multiple non WordPress vhosts</strong><br />
If you want to host a multisite setup or add additional websites to your server or VPS you can include the WordPress Multisite rewrite rules in a separate file and simplify your per site vhosts.</p>
<p><strong>File: /etc/nginx/nginx.conf</strong></p>
<pre class="brush: plain; title: ; notranslate">
user www-data;
worker_processes  10;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
	include mime.types;
	default_type       application/octet-stream;
	access_log         /var/log/nginx/access.log;
	sendfile           on;
#	tcp_nopush         on;
	keepalive_timeout  3;
#	tcp_nodelay        on;
#	gzip               on;
	client_max_body_size 13m;
	index              index.php index.html index.htm;

	upstream php {
	#	server 127.0.0.1:9000;
		server unix:/tmp/php-fpm.sock;
	}

	include sites-enabled/*;
}
</pre>
<p><em>This is a sample vhost for a subdomain WordPress Multisite that uses the <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Domain Mapping Plugin</a> along with a few static sites that are also hosted on the server.</em></p>
<pre class="brush: plain; title: ; notranslate">

server {
	 listen 80;
	#Add a server_name entry for each mapped domain
	server_name star.main-multisite-domain.com *.main-multisite.com;
        server_name mapped-domain.com www.mapped-domain.com;
	server_name mapped-domain-2.com www.mapped-domain-2.com;
	server_name mapped-domain-3.com www.mapped-domain-3.com;

	root /srv/www/wordpress/public;
	access_log /srv/www/wordpress/logs/access.log;
	error_log /srv/www/wordpress/logs/error.log;
	index index.php index.html index.htm;

        #The Multisite rules are in the include below
	include global-wp-multi.conf;
}

#Begin Static Non WP Sites
#Repeat the vhosts below for each additional static site.  Make sure you make each one a root directory
server {

	server_name static-non-wp-domain.com www.static-non-wp-domain.com;
	root /srv/www/static-non-wp-domain/public;

        error_log /srv/www/static-non-wp-domain/logs/error.log;
	index index.php index.html index.htm;

	}
</pre>
<p><strong>File: /etc/nginx/global-wp-multi.conf</strong><br />
This is a default config file that will handle the rewrite rules for domain mapped subdomain multisites.</p>
<pre class="brush: plain; title: ; notranslate">
error_page 404 = @wordpress;
log_not_found off;

location / {
	try_files $uri $uri/ /index.php?$args;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
	expires 24h;
	log_not_found off;
}

rewrite ^/files/(.+) /wp-includes/ms-files.php?file=$1 last;

location ^~ /files/ {
	rewrite ^.*/files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}

include wp-total.conf;

# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
	rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
	rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}

location @wordpress {
        fastcgi_pass php;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        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  SCRIPT_FILENAME    $document_root$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;

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_NAME /index.php;
}

location ~ \.php$ {
	try_files $uri @wordpress;
	fastcgi_index index.php;
	fastcgi_pass php;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	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  SCRIPT_FILENAME    $document_root$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;

        fastcgi_pass 127.0.0.1:9000;
}
</pre>
<p><strong>File: /etc/php5/conf.d/apc.ini</strong></p>
<pre class="brush: plain; title: ; notranslate">
; configuration for php apc module
extension = apc.so
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 512M
apc.optimization = 0
apc.num_files_hint = 2700
apc.user_entries_hint = 2700
apc.ttl = 7200
apc.user_ttl = 3600
apc.gc_ttl = 600
apc.cache_by_default = 1
apc.slam_defense = 1
apc.use_request_time = 1
apc.mmap_file_mask = /dev/zero
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 2M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
apc.rfc1867 = 0
apc.rfc1867_prefix = &quot;upload_&quot;
apc.rfc1867_name = &quot;APC_UPLOAD_PROGRESS&quot;
apc.rfc1867_freq = 0
apc.localcache = 1
apc.localcache.size = 1350
apc.coredump_unmap = 0
apc.stat_ctime = 0
</pre>
<p>Php.ini is located at /etc/php5/php.ini use the production defaults explained in the file.</p>
<p><strong>File: /etc/my.cnf</strong><br />
The default is very long and well documented. Copy it to my.cnf.back and use this as a starting place (have at least 1GB Ram before using this file)</p>
<pre class="brush: plain; title: ; notranslate">
[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
language	= /usr/share/mysql/english
skip-external-locking
key_buffer	= 16M
max_allowed_packet  = 16M
thread_stack	    = 192K
thread_cache_size   = 16
myisam-recover      = BACKUP
max_connections     = 100
table_cache         = 256
thread_concurrency  = 16
query_cache_limit   = 4M
query_cache_size    = 128M
general_log_file    = /var/log/mysql/mysql.log
general_log         = 1
log_slow_queries    = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

expire_logs_days    = 10
max_binlog_size     = 100M

[mysqldump]
quick
quote-names
max_allowed_packet   = 16M

[isamchk]
key_buffer	    = 16M

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
</pre>
<p>Whenever you make changes to a .conf file you need to restart the server to apply your changes.</p>
<pre class="brush: plain; title: ; notranslate">
/etc/init.d/mysql restart
/etc/init.d/nginx restart
</pre>
<h3>WordPress via svn and setting up W3 Total Cache</h3>
<p>The server is ready to install WordPress</p>
<p><strong>Create your database</strong></p>
<pre class="brush: plain; title: ; notranslate">
mysql  -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt; CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)

mysql&gt; GRANT ALL PRIVILEGES ON databasename.* TO &quot;user_name&quot;@&quot;localhost&quot;
    -&gt; IDENTIFIED BY &quot;password&quot;;
Query OK, 0 rows affected (0.00 sec)

mysql&gt; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql&gt; EXIT
Bye
</pre>
<p><strong>Install WordPress via SVN</strong></p>
<pre class="brush: plain; title: ; notranslate">
cd /srv/www/yourdomain/public
svn co http://core.svn.wordpress.org/tags/3.2.1 .
</pre>
<p>Add your database info to wp-config.php and install by visiting yourdomain.com/wp-admin/install.php</p>
<p>Use the Compatibility Check in W3 Total Cache to make sure everything is set up right. Yours will look similar to this one.</p>
<p><a class="selector" href="http://i1.wp.com/c3mdigital.com/files/2011/07/General-Settings-W3-Total-Cache-‹-Glasstire-—-WordPress.png"><img class="aligncenter size-large wp-image-1213" title="General Settings | W3 Total Cache  — WordPress" src="http://i1.wp.com/c3mdigital.com/files/2011/07/General-Settings-W3-Total-Cache-‹-Glasstire-—-WordPress.png?resize=580%2C525" alt="" data-recalc-dims="1" /></a></p>
<p>Set page cache and minify to disk enhanced. Object and database to APC. You can experiment with page cache via APC but with Nginx disk enhanced will most likely be faster.</p>
<h3>Final thoughts</h3>
<p>If your doing this for the first time set up a test install to get the hang of if before you rely on this for a production set up or client site. Using Debian and the apt-get repos it&#8217;s pretty easy to manage your own dedicated server or VPS and you can lose the cPanel training wheels. Not only will your page load times drop you will have a good feeling of accomplishment.</p>
<p>To maintain your packages run apt-get update and apt-get upgrade every once in a while and you can follow <a href="http://twitter.com/#!/dotdeb">@dotdeb</a> on Twitter to stay up to date with upgrades.</p>
<p>Feel free to leave a comment or question. I would love to hear how this set up works for you.</p>
<p><strong>Resources and further reading</strong></p>
<ul>
<li><a href="http://forum.nginx.org/">The Nginx forums</a></li>
<li><a href="http://wiki.nginx.org/">The Nginx Wiki</a></li>
<li><a href="http://www.anilcetin.com/convert-apache-htaccess-to-nginx/">.htaccess to Nginx rule converter</a></li>
<li><a href="http://www.w3-edge.com/wordpress-plugins/w3-total-cache/">W3 Total Cache &#8211; WordPress Optimization</a></li>
<li><a href="http://www.quora.com/Why-nginx-is-so-efficient">Mark Jaquith on Quora &#8211; Why is Nginx so efficient?</a></li>
<li><a href="http://markjaquith.wordpress.com/2011/07/17/speaking-at-wordcamp-sf-2011/">SCALING, SERVERS, AND DEPLOYS — OH MY!</a></li>
<li><a href="http://www.amazon.com/Official-Ubuntu-Server-Book-2nd/dp/0137081332">The Official Ubuntu Server Book 2nd Edition</a></li>
</ul>
<p>Your just finished reading <a href="http://c3mdigital.com/wordpress-performance-server/">WordPress Performance Server &#8211; Debian “squeeze” with Nginx, APC and PHP from the Dotdeb repos</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/wordpress-performance-server/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Response to &quot;Open Source Motivations&quot;</title>
		<link>http://c3mdigital.com/open-source-motivations/</link>
		<comments>http://c3mdigital.com/open-source-motivations/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 22:25:51 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Community Support]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=1004</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/open-source-motivations/">Response to &quot;Open Source Motivations&quot;</a> </p><p>In the article Alex answers some tough questions about the motivations, financial gain (or lack of), and indirect financial benefits of writing, maintaining and supporting "free" WordPress Plugins.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/open-source-motivations/">Response to &quot;Open Source Motivations&quot;</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/open-source-motivations/">Response to &quot;Open Source Motivations&quot;</a> </p><p>This post is in response to a  write up entitled <a href="http://alexking.org/blog/2010/12/01/open-source-motivations">&#8220;Open Source Motivations&#8221;</a> by long time WordPress developer, contributor and plugin author, <a href="http://alexking.org/">Alex King</a>.</p>
<p>Alex runs a successful and well known software and development consultancy firm, <a href="http://crowdfavorite.com/">Crowd Favorite</a>, along with <a href="http://wphelpcenter.com/">WordPress Help Center</a>, a specialized WordPress support center.</p>
<p>In the article Alex answers some tough questions about the motivations, financial gain (or lack of), and indirect financial benefits of writing, maintaining and supporting &#8220;free&#8221; WordPress Plugins.  Alex&#8217;s response to the questions along with some of the reactions on Twitter suggest that the current situation is unsustainable for developers.</p>
<p><strong>I disagree with this</strong></p>
<blockquote><p>I actually feel strongly that the current situation is unsustainable. Unless the WordPress community at large starts to better recognize and reward the developers that create the tools that they use and rely on, the developers wonâ€™t/canâ€™t continue to provide as they have.</p></blockquote>
<p>Why it might not be financially beneficial for large shops like his to continue developing and supporting free themes and plugins, it is very beneficial to individual developers like myself, and others whose release of free plugins and themes have brought them great financial gain.</p>
<p><strong>How do you think developers like Alex and others got to where they are today?</strong></p>
<p>I strongly believe that part of the success of Crowd Favorite was due to the contributions that were made to b2 and to the WordPress community.  Others like Jason Schuller, Brian Gardner and Cory Miller  attributed part of the success of their Premium Theme businesses to releasing free themes to the community.  You can listen to the interviews and discussion about this very topic on Jeff Chandler&#8217;s <a href="http://www.wptavern.com/wpweekly-episode-94-%E2%80%93-commercial-themes">WordPress Weekly episode 94</a>.</p>
<p><strong>Contributing to the WordPress community is a way for smaller developers to make a name for themselves, get experience and prove to potential clients that they know what their doing.</strong></p>
<p>WordPress.org gives you the opportunity to put your product in front of millions of people.  Currently I have only released one plugin, <a href="http://wordpress.org/extend/plugins/wp-coda-slider/">WP Coda Slider</a>,  on WordPress.org.   My plugin is pretty simple and the only options available for it have to be put inside of a shortcode or through the use of a template tag but the response I have gotten has been great.   Hosting the demo of and providing support for the plugin on WP-Performance gets me around 250 &#8211; 500 visitors a day.</p>
<p><strong>In fact my simple little plugin has brought 8,267 visitors to my site since I released it back in September.</strong></p>
<p><a class="selector" href="http://i2.wp.com/c3mdigital.com/files/2010/12/wporg.png"><img src="http://i2.wp.com/c3mdigital.com/files/2010/12/wporg.png?resize=450%2C117" alt="" class="aligncenter size-medium wp-image-1005" data-recalc-dims="1" /></a></p>
<p>Website traffic may not be that big of a deal for the well known players in the WordPress development community but it has offered me the opportunity to expose my WordPress support and development services to a great number of people.  In the last three months I have gotten around 4 or 5 new really good clients who found me through my plugin.  I also find it very rewarding to help others and I am amazed that people are actually using software I created on their websites.</p>
<p><strong>One of the most troubling parts of Alex&#8217;s article is his sentiment towards the users of his products:</strong></p>
<blockquote><p>In talking with other plugin developers, it seems fairly universal that the reward for a successful plugin is a deluge of support email that includes the worst kind of sense of entitlement, rudeness and ignorance. The community as a whole seems to expect to be able to pay nothing, yet received expert and individual help and support for free.</p></blockquote>
<p><strong>I completely disagree that the community as a whole has this type of entitlement.</strong></p>
<p>I am sure there are those out there who don&#8217;t understand how much work and effort developers like Alex put into a free product but I have found that a majority of the community is very appreciative and also very polite when it comes to getting support for a free plugin.  Any time I have offered free help or support to other WordPress uses it has been a very pleasurable experience.  See for yourself on my <a href="http://wp-performance.com/wp-coda-slider/">plugins support page</a>.  Almost every single request contains a thank you and is very polite.  The same is true when I answer questions in the <a href="http://wordpress.org/support/profile/c3mdigital">WordPress.org support forums</a> or on Stack Exchanges <a href="http://wordpress.stackexchange.com/users/251/chris-o">WordPress Answers site</a>.</p>
<blockquote><p>I used to get about $100-200/month in the way of donations through my website. Unfortunately due to changes in the way plugins are presented on WordPress.org that has dried up to about $5/month.</p></blockquote>
<p>Ask any Plugin author about the &#8220;donations&#8221; they have received for their work and they will laugh because donations for WordPress Plugins have almost always been non existent.  If your counting on donations to make it or to feel appreciated then the &#8220;FREE&#8221; Plugin business is not for you.  This is not the fault of WordPress.org&#8217;s new plugin page design this is how it will always be.</p>
<p>It is very understandable that busy dev shops with payrolls to make and lots of clients to keep them busy don&#8217;t have the time, energy, resources or find it rewarding enough to contribute then thats fine.  There are plenty others who do and are thankful for the opportunity to contribute and without an open source community like WordPress none of you would be in business today.</p>
<p>Thanks for taking the time to read this and I welcome your thoughts and comments below.</p>
<p>UPDATE: There has been a lot of discussion on this topic including a <a href="http://weblogtoolscollection.com/archives/2010/12/02/open-source-motivations-whats-yours/">great post by Jeff Chandler</a></p>
<p>Your just finished reading <a href="http://c3mdigital.com/open-source-motivations/">Response to &quot;Open Source Motivations&quot;</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/open-source-motivations/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Reduce Page Loading Time by 300% With W3 Total Cache</title>
		<link>http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/</link>
		<comments>http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 22:35:51 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=822</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/">Reduce Page Loading Time by 300% With W3 Total Cache</a> </p><p>Not all WordPress users are able to host their blog or website on a private server or VPS and need a way to speed up their websites.  There are a few great WordPress caching plugins like WP Super Cache and W3 Total Cache.</p></p><p>Your just finished reading <a href="http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/">Reduce Page Loading Time by 300% With W3 Total Cache</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/">Reduce Page Loading Time by 300% With W3 Total Cache</a> </p><p>I recently answered a question over at <a href="http://wordpress.stackexchange.com/">WordPress Answers</a>, Stack Exchanges new WordPress question and answer site, about <a href="http://wordpress.stackexchange.com/questions/2213/what-are-the-best-practices-for-using-a-caching-plugin-on-a-shared-host">best practices for using a caching plugin with a shared host</a>.</p>
<p>Not all WordPress users are able to host their blog or website on a private server or VPS and need a way to speed up their websites. There are a few great WordPress caching plugins like WP Super Cache and W3 Total Cache. Both plugins are very popular, well supported by their authors and do a good job of caching.<br />
<span id="more-822"></span><br />
WP Super Cache is developed and supported by <a href="http://ocaoimh.ie/">Donncha O Caoimh</a> who is a member of the <a href="http://automattic.com/about/">Automattic </a> team and a core WordPress contributor.</p>
<p>W3 Total Cache was originally developed for<a href="http://mashable.com/"> Mashable.com </a> by their CTO, <a href="http://www.w3-edge.com/">Frederick Townes </a>.</p>
<p>W3 Total Cache is much more than a caching plugin. Along with page caching, W3 also does object caching, database caching, minifies and combines css and js files and also has built in CDN (Content Delivery Network) support. This is the only plugin available that tackles all the best practices of <a href="http://www.stevesouders.com/blog/">High Performance Websites</a></p>
<h5>On shared hosting plans your caching options are limited.</h5>
<p>You will only be able to statically cache the html output from your pages. This is the fastest way to serve pages but you loose the dynamic aspects of WordPress like making comments and seeing the latest comments on posts.</p>
<p>There are disk caching options available in W3 Total Cache for objects and database but for object caching you will only see gains if your host is running fast drives and most sites have far too many queries per page (due to poorly written plugins) to see any advantage from database disk caching.</p>
<p>When the plugin is first activated the recommended settings will already be in place.</p>
<h3>How to Configure the plugin for best performance on a shared hosting plan</h3>
<p>This article will go through all the steps of setting up the plugin to get the best performance gains on a shared host. If your on a VPS or private server you will have a lot more features to work with like using a PHP opcode cache and caching database queries in memory.</p>
<h3>Page Cache Settings</h3>
<p>Check all the options for page cache<img class="aligncenter no-border size-full wp-image-823" src="http://i2.wp.com/c3mdigital.com/files/2010/09/pagecache-e1285364652655.jpg?resize=500%2C362" alt="page cache settings" data-recalc-dims="1" /></p>
<h3>Cache Preload</h3>
<p>Turn this on and set the update interval at what ever is appropriate for your site. This will rebuild the page cache at the given interval.<img class="aligncenter no-border size-full wp-image-824" src="http://i1.wp.com/c3mdigital.com/files/2010/09/cache-preload-e1285365004810.jpg?resize=450%2C284" alt="cache preload settings" data-recalc-dims="1" /></p>
<h3>Minify Settings</h3>
<p>Select Rewrite url structure and if your going to use the CDN check the auto upload so newly minified files will automatically get uploaded to the CDN. <img class="aligncenter no-border size-full wp-image-825" src="http://i1.wp.com/c3mdigital.com/files/2010/09/minify-e1285365153726.jpg?resize=500%2C275" alt="minify settings" data-recalc-dims="1" /></p>
<h3>Minify HTML Settings</h3>
<p>Enable and check remove line breaks, inline js and css minification. If your using adsense or another service that uses comment stems enter them here to avoid having them minified. <img class="aligncenter no-border size-full wp-image-826" src="http://i0.wp.com/c3mdigital.com/files/2010/09/minifyhtml.jpg?resize=467%2C333" alt="minify html settings" data-recalc-dims="1" /></p>
<h3>CSS and Javascript Minify Settings</h3>
<p>In the file management choose your theme and add any css files you want combined and minified. There is also a help wizard that will search all your templates and add the suggested files for you.</p>
<h3>Using The Help Wizard</h3>
<p>W3 Total includes a tool that goes through your theme templates and finds Javascript and CSS files that are used and provides recommended settings. First try theses settings and if problems are encountered go back and modify as needed. Any files highlighted in red are files you have already included to be minified.</p>
<p>The minify settings give you the option of placing the minified files in different locations. After &lt;head&gt;, after &lt;body&gt; and before &lt;/body&gt;. It is best to put as many as you can before &lt;/body&gt;. If any plugins add inline js you won&#8217;t be able to use before &lt;/body&gt; for jquery or the plugins js because it will need to load before any inline &lt;script&gt; tags. You can include any combinations of files in each location and for each template. For instance you can set your comment-reply.js to only load on single.php<br />
<img class="aligncenter size-full wp-image-840" src="http://i2.wp.com/c3mdigital.com/files/2010/09/minify-wizard.png?resize=460%2C486" alt="minify wizard" data-recalc-dims="1" /></p>
<h3>Browser Cache Settings</h3>
<p>This is the most important one to get right. If you properly cache your static content in your users browsers you can drastically reduce page load times and reduce bandwidth usage.</p>
<h3>General</h3>
<p>Check everything. Make sure and check &#8220;do not process 404 errors for static objects&#8221;. browser cache settings is a big win for shared hosting because invoking PHP and returning 404 pages to bots etc is a big drain on resources and this feature prevents that.<br />
<img class="aligncenter no-border size-full wp-image-835" src="http://i1.wp.com/c3mdigital.com/files/2010/09/browser-cache-settings.png?resize=500%2C484" alt="browser-cache settings" data-recalc-dims="1" /></p>
<h3>CSS and Javascript Browser Cache Settings</h3>
<p>Check everything and set expires header lifetime to far future. 31536000 seconds is 1 year and what <a href="http://developer.yahoo.com/yslow/">yslow</a> recommends. If you make changes to your css or javascript you have to change the file names to prevent users from using the old version. If your using minify you won&#8217;t have to worry about serving outdated content because W3 takes care of changing the name of the minified file for you.</p>
<p>Set your cache Control policy to cache with max age.<br />
<img class="aligncenter no-border size-full wp-image-836" src="http://i0.wp.com/c3mdigital.com/files/2010/09/browser-cache-files.png?resize=500%2C333" alt="browser cache file settings" data-recalc-dims="1" /></p>
<p>There are two more browser cache setting sections. HTMl and Images. For Images use the same settings as CSS and JS.</p>
<p>For HTML don&#8217;t set expires unless your site is mainly static. You can use short lifetimes if you want (180 seconds) but I wouldn&#8217;t go higher. Enable gzip and you can check &#8220;set W3 Headers&#8221; so you can check the response headers to make sure they are working.<br />
<img class="aligncenter no-border size-full wp-image-837" src="http://i1.wp.com/c3mdigital.com/files/2010/09/browser-cache-html.png?resize=500%2C353" alt="browser cache html settings" data-recalc-dims="1" /></p>
<h3>CDN Settings</h3>
<p>CDN is one of the largest performance wins for any hosting scenario even if self-hosted. W3 Total has built in support for popular origin pull and origin push CDN&#8217;s and a robust self hosted option that requires you to set up subdomains and cnames. Note: Do not check force override unless new files are being overwritten. Force override will constantly re-upload files even if they already exist. This wastes bandwidth and resources.<br />
<img class="aligncenter no-border size-full wp-image-838" src="http://i0.wp.com/c3mdigital.com/files/2010/09/cdn-general.png?resize=500%2C395" alt="cdn general settings" data-recalc-dims="1" /></p>
<p>Self hosted CDN will let you take advantage of pipelining. Browsers can only download a few files at once, only 4 in some cases. Pipelining is a technique whereby aliases (subdomains for example) of your server are used to allow your browser to increase the practical limit of files that can be downloaded in parallel. Doing so maximizes the throughput of the your internet connection and allows the browser to render a page faster. W3TC takes care of managing these files transparently once DNS CNAMEs (aliases) and subdomains are properly configured.<br />
<img class="aligncenter no-border size-full wp-image-839" src="http://i1.wp.com/c3mdigital.com/files/2010/09/cdn-hostname-settings.png?resize=500%2C367" alt="cdn hostname settings" data-recalc-dims="1" /></p>
<h3>Support</h3>
<p>W3 Total Cache is one of the best supported plugins on the WordPress.org plugin repository. The author responds to all questions <a href="http://wordpress.org/tags/w3-total-cache">tagged w3-total-cache </a> and a support tab is also included in the plugin to use for reporting bugs.</p>
<h5>Testing</h5>
<p>You should always test your results and tweak your settings accordingly. I like to use <a href="http://www.webpagetest.org/">WebPageTest.org</a>. To compare my results and identify any potential problems.</p>
<h5>How much can you increase your performance using W3 Total Cache on WordPress with shared hosting?</h5>
<p>I recently helped a client reduce his page load times from almost 10 seconds to 3 seconds by implementing these settings on his WordPress blog.</p>
<h5>Before:</h5>
<p><img class="aligncenter no-border size-full wp-image-832" src="http://i2.wp.com/c3mdigital.com/files/2010/09/before-e1285366518625.jpg?resize=500%2C532" alt="results before w3 total cache" data-recalc-dims="1" /></p>
<p>As you can see by the waterfall image he was loading javascript before css which causes a blocking condition. Blocking is when the loading of a script or file makes all other requests wait until it is fully downloaded. He also had 50 external file requests and some 404 errors.</p>
<h3>After installing and configuring W3 Total Cache</h3>
<p><img class="aligncenter no-border size-full wp-image-833" src="http://i2.wp.com/c3mdigital.com/files/2010/09/after-e1285366746269.jpg?resize=500%2C451" alt="after installing w3 total cache" data-recalc-dims="1" /></p>
<p>These results are not perfect but they are a dramatic improvement over what they were. We reduced the total time to load the page from 10 seconds to 3 seconds. By combining and removing the javascript to the bottom we reduced the Start Render time from 3.5 seconds to .45 seconds. The start render time is very important because it indicates when the page starts becoming viewable in the browser. This progressive rendering effect gives the illusion of instant page loads because the user doesn&#8217;t notice there are still files being loaded in the background below the fold.</p>
<h3>Conclusion</h3>
<p>W3 Total Cache is the best choice for a caching plugin because it has so many more features than just caching. What has your experience been with W3 Total Cache or other web performance solutions? I would love to hear some of your best practice tips lets discuss this further in the comments.</p>
<h3>Other Performance Resources</h3>
<p><a href="http://c3mdigital.com/2010/08/optimizing-wordpress-performance-wordcamp-houston/">Optimizing WordPress for Performance</a>, my WordCamp Houston presentation.<br />
<a href="http://c3mdigital.com/2010/08/add-re-tweet-button-iframe-faster-page-loads/">How to add a re tweet button in an Iframe after the page loads for better performance</a><br />
<a href="http://www.w3-edge.com/weblog/2009/12/the-quest-for-speed/">The Quest for Speed </a>  by Frederick Townes</p>
<p>Your just finished reading <a href="http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/">Reduce Page Loading Time by 300% With W3 Total Cache</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/reduce-page-loading-time-w3-total-cache/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Add a Re-Tweet Button in an Iframe for Faster Page Loads</title>
		<link>http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/</link>
		<comments>http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 00:27:33 +0000</pubDate>
		<dc:creator>Chris Olbekson</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://c3mdigital.com/?p=794</guid>
		<description><![CDATA[<p><p>Continue reading: <a href="http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/">Add a Re-Tweet Button in an Iframe for Faster Page Loads</a> </p><p>One of the topics discussed in my WordCamp Houston Presentation, Optimizing For Performance, was putting social media share buttons in an iframe to improve page rendering. I thought it would be helpful to describe in more detail how to accomplish this. Since Facebook already does a pretty good job of putting their widget code in [...]</p></p><p>Your just finished reading <a href="http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/">Add a Re-Tweet Button in an Iframe for Faster Page Loads</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Continue reading: <a href="http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/">Add a Re-Tweet Button in an Iframe for Faster Page Loads</a> </p><p>One of the topics discussed in my WordCamp Houston Presentation, Optimizing For Performance, was putting social media share buttons in an iframe to improve page rendering.  I thought it would be helpful to describe in more detail how to accomplish this.</p>
<p>Since Facebook already does a pretty good job of putting their widget code in an iframe we will use the TweetMeMe Re-Tweet button for this example.  If you were to just put the code directly in an iframe it wouldn&#8217;t help much because Javascript embedded in an iframe will block the rest of the page from loading until it was complete.</p>
<p>To accomplish our goal of progressive page rendering we will need to start with a div placeholder for our iframe code and write a short Javascript function to add the iframe code to our placeholder div once the page has completely loaded.  This is the same method Fredrick Townes, creator of the <a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3-Total Cache</a> plugin and CTO of Mashable.com, uses to place the buttons on Mashable.</p>
<p>First we need to add our div placeholder to our template files where we want the Tweetmeme button to appear.  In this case we will use div id=&#8221;tm_box&#8221; then close the div.</p>
<p>Next we will need to build our iframe src variable.</p>
<p>1. Start with the button.js url that Tweetmeme provides in their embed code:</p>
<pre class="brush: plain; title: ; notranslate">

http://api.tweetmeme.com/button.js

</pre>
<p>2. Add </p>
<pre class="brush: plain; title: ; notranslate">
?url= 
</pre>
<p> followed by the page url (for now we will add URL as a placeholder because we will want the url to be whatever page the button is placed on).<br />
3. Add <code>&amp;style=</code> followed by what button style you will want to use.  Either normal or compact.<br />
4. Add <code>&amp;source=</code> followed by your Twitter username.<br />
5. Add <code>&amp;service=</code> followed by a URL shortening service for ease of use we will use the bit.ly service see the Tweetmeme api reference on how to add other services.</p>
<p>Your completed src variable will look something like this:</p>
<pre class="brush: plain; title: ; notranslate">

http://api.tweetmeme.com/button.js?url=URL&amp;style=normal&amp;source=Chris_Olbekson&amp;service=bit.ly

</pre>
<p>Now we will set the width and height attributes:</p>
<p>For the normal style button: <code>width="50" height="61"</code><br />
For the compact style button <code>width="90" height="20"</code></p>
<p>Now that we have all our variable our iframe code will look something like this:<br />
<code>
<pre>&lt;iframe src="http://api.tweetmeme.com/button.js?url=URL&amp;style=normal&amp;source=Chris_Olbekson&amp;service=bit.ly" scrolling="no" frameborder="0" width="50" height="61" &gt;&lt;/iframe&gt;</pre>
<p></code></p>
<p>Now to convert your iframe code from html to JavaScript you can use this simple online <a href="http://www.accessify.com/tools-and-wizards/developer-tools/html-javascript-convertor/">HTML to JavaScript Converter</a><br />
<a href="http://i2.wp.com/c3mdigital.com/files/2010/08/html-java-e1281484904301.png"><img src="http://i2.wp.com/c3mdigital.com/files/2010/08/html-java-e1281484904301.png?resize=350%2C318" alt="" class="aligncenter size-full wp-image-795" data-recalc-dims="1" /></a></p>
<p>Next we need a JavaScript function get the current page url.  We will use the <code>escape()</code> function just like TweetMeme uses in its button.js and we will add <code>window.onload = tweetMemeButton</code> which will fire the code after the page is completely loaded.</p>
<p>Here is our completed JavaScript which we can save as an external file and call it in header.php or footer.php (It won&#8217;t matter where we call it because it won&#8217;t fire till the page is loaded).</p>
<pre class="brush: plain; title: ; notranslate">

function tweetMemeButton() {
	if (document.getElementById(&quot;tm_box&quot;)) {
		var iframeCode= &quot;&quot;;
iframeCode += &quot;&amp;lt;iframe src=&quot;http://api.tweetmeme.com/button.js?url=&quot; + escape(document.URL) + &quot;&amp;amp;style=normal&amp;amp;source=chris_olbekson &amp;amp;service=bit.ly&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; width=&quot;50&quot; height=&quot;61&quot; &amp;gt;&quot;;

		document.getElementById(&quot;tm_box&quot;).innerHTML = iframeCode;
	}
}

window.onload = tweetMemeButton;

</pre>
<p><del datetime="2010-08-18T02:25:16+00:00">This code is used to add the TweetMeMe Re-Tweet button at the end of this post.</del></p>
<p>**Update: 08/12/2020<br />
Twitter just announced the release of their new tweet button.  I will be evaluating the performance over the next few days.</p>
<p>Your just finished reading <a href="http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/">Add a Re-Tweet Button in an Iframe for Faster Page Loads</a>.  For more resources like this go to <a href="http://c3mdigital.com">C3M DIGITAL</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://c3mdigital.com/add-re-tweet-button-iframe-faster-page-loads/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
