<?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>Patrick O'Doherty &#187; memory</title>
	<atom:link href="http://patrickodoherty.com/tag/memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://patrickodoherty.com</link>
	<description>Ramblings on anything and everything</description>
	<lastBuildDate>Wed, 16 Jun 2010 15:46:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>From Apache to NGINX</title>
		<link>http://patrickodoherty.com/2009/07/from-apache-to-nginx/</link>
		<comments>http://patrickodoherty.com/2009/07/from-apache-to-nginx/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:20:59 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[net]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[stability]]></category>

		<guid isPermaLink="false">http://patrickodoherty.com/2009/07/from-apache-to-nginx/</guid>
		<description><![CDATA[Recently I decided that I would try to replace my Apache installation with one of it&#8217;s competitors to see what could be gained from a change. While I&#8217;d heard good things (and bad) about Lighttpd (lighty) I decided it would be interesting to go with the underdog nginx.org nginx.org was originally developed to cater for [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I decided that I would try to replace my Apache installation with one of it&#8217;s competitors to see what could be gained from a change. While I&#8217;d heard good things <strong>(and bad)</strong> about Lighttpd (lighty) I decided it would be interesting to go with the underdog <a href="http://nginx.org" title="NGINX">nginx.org</a></p>

<p><a href="http://nginx.org" title="NGINX">nginx.org</a> was originally developed to cater for the needs of Rambler, a Russian search engine. It has quickly gained numbers though, and recent surveys put it as fifth most used web server on the internet today. It has many nice features, but above all <strong>has a reputation for stability</strong>, something I can&#8217;t say Lighttpd has in quantities.</p>

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

<h2>Installation</h2>

<p>As usual I installed nginx through apt and started to configure it to my needs until I noticed many of the things on the <a href="http://wiki.nginx.org" title="Wiki">wiki</a> weren’t working for some reason. I decided to check the version apt had installed and was surprised to find that not only was it a few revisions behind the current stable release, it was what looked to be a <strong>year or more out of date</strong>. A lot of new features had been implemented since this release so I decided to install from source instead.</p>

<p>I managed to find some great articles on <a href="http://articles.slicehost.net" title="Slicehost">Slicehost</a> about installing NGINX on Ubuntu Intrepid which even included the making of a init.d script for the install (very handy).</p>

<p>Once everything was installed I had to configure the installation for use with fastcgi for php scripts. This was the hardest part of the install as it isn&#8217;t the easiest thing to get running compared to the Apache route. Many of the articles I googled included installing lighttpd for the spawn-fcgi functionality, though fortunately this has since been forked into it&#8217;s own project at <a href="http://redmine.lighttpd.net/projects/spawn-fcgi/news" title="Spawn-FCgi">Lighttpd.net</a>.</p>

<h2>Fast-CGI PHP support</h2>

<p>I installed this along with another init.d script for Spawn-FCGI which I found over at <a href="http://blog.codefront.net/2007/06/11/nginx-php-and-a-php-fastcgi-daemon-init-script/" title="Codefront Blog">Codefront.net</a>. Once that was done it was a process of porting all my existing virtualhosts over to NGINX.</p>

<h2>Configuration</h2>

<p>I decided to use a similar system to Apache for handling my virtualhost configuration files by making a sites-available and sites-enabled directory for them and telling nginx to include all the the configuration files in sites-available. This means that putting a site online is exactly the same as with apache by making the necessary configuration file and then placing a symbolic link in the sites-enabled directory. Handy!</p>

<p>After that it was on to rewriting the mod&#95;rewrite rules for nginx, something which actually was not <em>as</em> hard as I had expected it to be. The one thing that you have to be aware of with nginx is that in each virtualhost config file if you want to have php files executed you need to include the necessary block that tells nginx to pass them off to your fast-cgi process. Not that difficult to do at all, just something I didn&#8217;t think of in my first round.</p>

<h2>Gains?</h2>

<p>So after all that what have I gained? Well for one nginx seems to use <strong>half the memory Apache did</strong> while still providing a speed increase for static content and php files. Worth it? <strong>Definitely!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://patrickodoherty.com/2009/07/from-apache-to-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
