<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Nginx PHP</title>
	<atom:link href="http://nginxphp.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nginxphp.wordpress.com</link>
	<description>Nginx PHP Fastcgi Cache Php-fpm How To</description>
	<lastBuildDate>Sat, 16 Oct 2010 03:09:05 +0000</lastBuildDate>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nginxphp.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Nginx PHP</title>
		<link>http://nginxphp.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nginxphp.wordpress.com/osd.xml" title="Nginx PHP" />
	<atom:link rel='hub' href='http://nginxphp.wordpress.com/?pushpress=hub'/>
		<item>
		<title>DooPhp Model DB Class For Sharded DB PHP MySql Parse Ini PDO</title>
		<link>http://nginxphp.wordpress.com/2010/10/15/doophp-model-db-class-for-sharded-db-php-mysql-parse-ini/</link>
		<comments>http://nginxphp.wordpress.com/2010/10/15/doophp-model-db-class-for-sharded-db-php-mysql-parse-ini/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 12:55:23 +0000</pubDate>
		<dc:creator>honewatson</dc:creator>
				<category><![CDATA[Nginx PHP]]></category>
		<category><![CDATA[PHP Framework]]></category>
		<category><![CDATA[doophp]]></category>
		<category><![CDATA[Models]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Parse Ini]]></category>
		<category><![CDATA[pdo]]></category>
		<category><![CDATA[SharDb]]></category>

		<guid isPermaLink="false">http://nginxphp.wordpress.com/?p=29</guid>
		<description><![CDATA[I really like the DooSqlMagic for DooPhp apps with small amount of database tables (less than 100). It can get you up and running pretty fast and has pretty good performance for ORM. DooPhp has great php performance and a simple basic mvc structure. However there are three situations I can think of where this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=29&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I really like the DooSqlMagic for DooPhp apps with small amount of database tables (less than 100).</p>
<p>It can get you up and running pretty fast and has pretty good performance for ORM.  DooPhp has great php performance and a simple basic mvc structure.<span id="more-29"></span></p>
<p>However there are three situations I can think of where this kind of generated models in protected/models/ can be problematic.</p>
<p>1.  Optimizing complex queries.<br />
2.  Extended Vertical Partitioning<br />
3.  Extended Horizontal Partitioning (Database sharding)</p>
<p>I had an install of multi user wordpress which has 1000&#8242;s of tables over 1000&#8242;s of databases.  To be able to access this app with the DooPhp framework I also had to add in a class that allows the framework to access multiple databases on the same request.</p>
<p>So what did I do?</p>
<p>1.  I replaced Doo::db class with one that was basically the same as the SQL Magic class except all of the ORM is and sql generators is removed.  Function query() is rewritten to use PDO bindValues.</p>
<p>2.  I have one class in Models which parses php ini files (one file per view).  In the php ini files is the sql and bind paramaters.  Depending on the blog that is being accessed the db is changed and the table prefix is also changed.  This does not actually generate models but instead is a wrapper that quickly routes $variables like $_GET, $_POST into specific queries then executes them using PDO.  It would not require much to extend to use PDO Fetch Class for CUD views.</p>
<p>This is a sample of how the db controller looks although db prefix settings are generated on the fly:</p>
<pre>
    public function index(){

	    Doo::loadModel("BaseDb", false);

            // Initiate class and load /protected/sql/wordpress.ini file

	    $db = new BaseDb('wordpress');

	    // set the db prefix, usually for wordpress this will be wp_

	    $db-&gt;prefix = 'wp_2_';
	    $db-&gt;values = $this-&gt;params; // :post_type :post_status :limit

	    $db-&gt;sql_query = 'get_posts';
	    $results = $db-&gt;query();

	    // set query to get_tags
	    $db-&gt;sql_query = 'get_tags';

	    foreach($results as $result) {

		//add each post to post array
		$id = $result['ID'];
		$posts[$id ]['posts'] = $result;

		//get tags for this post ID
		$db-&gt;values['id'] = $id ;
		$posts[$id ]['tags'] = $db-&gt;query();

	    }

	    echo '
<pre>';
	    print_r($posts);
	    echo '</pre>
<p>';</p>
<p>	    //$this-&gt;renderc('index', $posts);<br />
    }
</pre>
<p>If you are interested in more you can visit here:</p>
<p><a href="http://github.com/honewatson/Parse-Ini-SQL">Parse Ini PDO Sql</a></p>
<p>I like Parse Ini File. It has a simple syntax and parse_ini_file is reasonably fast because its written in C.</p>
<p><a href="http://github.com/honewatson/Parse-Ini-SQL/blob/master/doo/protected/controller/WordpressController.php">WordPress Controller</a></p>
<p><a href="http://github.com/honewatson/Parse-Ini-SQL/blob/master/doo/protected/sql/wordpress.ini">Ini File Example</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nginxphp.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nginxphp.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nginxphp.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nginxphp.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nginxphp.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nginxphp.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nginxphp.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nginxphp.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=29&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nginxphp.wordpress.com/2010/10/15/doophp-model-db-class-for-sharded-db-php-mysql-parse-ini/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>DooPhp Benchmark &#8211; Non Bias</title>
		<link>http://nginxphp.wordpress.com/2010/02/05/doophp-benchmark-non-bias/</link>
		<comments>http://nginxphp.wordpress.com/2010/02/05/doophp-benchmark-non-bias/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 06:08:04 +0000</pubDate>
		<dc:creator>honewatson</dc:creator>
				<category><![CDATA[Nginx PHP]]></category>
		<category><![CDATA[PHP Framework]]></category>
		<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[doophp]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://nginxphp.wordpress.com/?p=23</guid>
		<description><![CDATA[DooPhp is a php framework that claims to be the fastest framework around. After testing out a Blog app on the framework I can confirm it certainly is fast for real world applications. It has some solid documentation and is simple to use. It has some nice helpers to get your applications started including a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=23&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>DooPhp is a php framework that claims to be the fastest framework around.  After testing out a Blog app on the framework I can confirm it certainly is fast for real world applications.</p>
<p><span id="more-23"></span></p>
<p>It has some solid documentation and is simple to use.  It has some nice helpers to get your applications started including a gui for building controllers and other tasks.  It&#8217;s got other good features built for scalability.</p>
<p>So I didn&#8217;t do an ab test first as a benchmark because it just hits the same page everytime.  I just loaded all the pages on the doophp demo blog from scratch and checked out the load times for the dynamic pages.  Now I&#8217;m not comparing to other frameworks but what I can confirm is after checking the my Nginx server logs, first time page renders are around 10 to 20 times faster than bare bones install of wordpress.</p>
<p>The cool thing about this framework is that it&#8217;s very easy to have a rest api and that its easy to design apps where only the dynamic parts of the page are loaded.  This makes it ideal for designing apps that can utilize Nginx&#8217;s SSI includes module.</p>
<p>With AB test.</p>
<p>I did a test on an old laptop with Nginx and PHP-FPM installed on Ubuntu.  ab -t 30 -c 10.  A test for 30&#8242;s for concurrency 10.</p>
<p>This test is pretty worthless in my opinion but doophp was still around 10 &#8211; 20 times faster depending on whether it was an index/archive/tag page or just a post page.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nginxphp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nginxphp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nginxphp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nginxphp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nginxphp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nginxphp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nginxphp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nginxphp.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=23&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nginxphp.wordpress.com/2010/02/05/doophp-benchmark-non-bias/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP-FPM APC Disk I/O</title>
		<link>http://nginxphp.wordpress.com/2010/01/28/php-fpm-apc-disk-io/</link>
		<comments>http://nginxphp.wordpress.com/2010/01/28/php-fpm-apc-disk-io/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 22:35:20 +0000</pubDate>
		<dc:creator>honewatson</dc:creator>
				<category><![CDATA[Nginx PHP]]></category>
		<category><![CDATA[Nginx Wordpress]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php-fpm]]></category>

		<guid isPermaLink="false">http://nginxphp.wordpress.com/?p=18</guid>
		<description><![CDATA[One of my PHP-FPM APC on Nginx installs was having some disk I/O from php-fpm children. I made a change to php.ini which reduced this by a factor of 5. 5x less disk I/O from php-fpm. I checked out where the disk I/O was coming from with Top. Once in Top by pressing capital &#8216;O&#8217; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=18&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of my PHP-FPM APC on Nginx installs was having some disk I/O from php-fpm children.  I made a change to php.ini which reduced this by a factor of 5.  5x less disk I/O from php-fpm. </p>
<p><span id="more-18"></span></p>
<p>I checked out where the disk I/O was coming from with Top.  Once in Top by pressing capital &#8216;O&#8217; then &#8216;p&#8217; let me see what was causing the minor disk I/O.</p>
<p>I have 1440 megabytes of Ram on this box.  php-fpm max_children should be set according to the specs of your box.  Just adding a large of max_children can at best use up your resources with little increase in performance and at worst bog down your server.</p>
<p>To fix it I changed my php.ini file.  Previously I&#8217;d changed my kernel.shmmax to 256m, set my php-fpm max_children to 25.  Then I had the following settings for APC (along with others) in php.ini:</p>
<p>apc.shm_segments = 1<br />
apc.shm_size = 256</p>
<p>I changed these to:</p>
<p>apc.shm_segments = 25<br />
apc.shm_size = 32</p>
<p>This reduced the disk I/O dramatically.   That&#8217;s 25 shared memory segments each with 32 megabytes of memory. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nginxphp.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nginxphp.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nginxphp.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nginxphp.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nginxphp.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nginxphp.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nginxphp.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nginxphp.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=18&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nginxphp.wordpress.com/2010/01/28/php-fpm-apc-disk-io/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Nginx Image Filter Module Mu WordPress Conf</title>
		<link>http://nginxphp.wordpress.com/2010/01/15/nginx-image-filter-module-mu-wordpress-conf/</link>
		<comments>http://nginxphp.wordpress.com/2010/01/15/nginx-image-filter-module-mu-wordpress-conf/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 06:37:17 +0000</pubDate>
		<dc:creator>honewatson</dc:creator>
				<category><![CDATA[Nginx PHP]]></category>
		<category><![CDATA[Nginx Wordpress]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://nginxphp.wordpress.com/?p=13</guid>
		<description><![CDATA[Nginx Image Filter Module is a fantastic module for serving resized images. Mu WordPress can use a lot of cpu&#8217;s and ram for image serving and this module can eliminate this problem. With this set up I was able to take my resized image serving up to 5000 requests per second. (2500 r/ps non cached, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=13&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Nginx Image Filter Module is a fantastic module for serving resized images.  Mu WordPress can use a lot of cpu&#8217;s and ram for image serving and this module can eliminate this problem.  With this set up I was able to take my resized image serving up to 5000 requests per second. (2500 r/ps non cached, 5000 r/ps proxy cached)</p>
<p><span id="more-13"></span></p>
<p>As outlined in my <a href="http://nginxphp.wordpress.com/2010/01/12/faster-nginx-wpmu-image-processing/">other nginx image filter module</a> post you need to implement the image at configuration time when you build nginx.</p>
<p>You have one nginx instance dedicated to image resizing and requests for image resizes get proxied to the nginx image serving instance from your main nginx server.</p>
<p>Resized images and cropped images are served like so:</p>
<p>Resize </p>
<p>http://subdomain.muinstall.com/ngimages/resize/files/2009/04/24879.jpg?w=120&#038;h=120</p>
<p>Crop</p>
<p>http://subdomain.muinstall.com/ngimages/crop/files/2009/04/24879.jpg?w=120&#038;h=120</p>
<p>You must include both w and h for width and height.  If you miss either of these parameters you&#8217;ll get 415 errors.</p>
<p>Install Nginx Image Server:</p>
<pre>
sudo apt-get install libgd2-xpm-dev
./configure --prefix=/usr/local/nginx_images --with-http_image_filter_module
make
make install
</pre>
<p>Copy /etc/init.d/nginx /etc/init.d/nginx_images</p>
<p>Make changes to following lines on /etc/init.d/<strong>nginx_images</strong>.</p>
<pre>
DAEMON=/usr/local/nginx_images/sbin/$NAME
PIDFILE=/usr/local/nginx_images/logs/$NAME.pid
</pre>
<p>Here is the config for the nginx image server (/usr/local/<strong>nginx_images</strong>/conf/nginx.conf):</p>
<pre>
user  www-data;
worker_processes  1;

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format small '$body_bytes_sent $request_time $request_uri $args $status $uri';

    sendfile        on;
    keepalive_timeout  65;

    server {
    listen       81;
    server_name  localhost;
    access_log  logs/host.access.log  small;

        location / {
                    root   html;
                    index  index.html index.htm;
        }

        location /crop/ {
                set $width $arg_w;
                set $height $arg_h;
                proxy_set_header Host $http_host;
                proxy_pass http://127.0.0.1:80;
                image_filter   crop  $arg_w $arg_h;
                error_page     415   = /empty;
        }

        location /resize/ {
                set $width $arg_w;
                set $height $arg_h;
                ### if we don't set proxy header as http_host the host is read a 127.0.0.1
                proxy_set_header Host $http_host;
                proxy_pass http://127.0.0.1:80;
                image_filter   resize  $arg_w $arg_h;
                error_page     415   = /empty;
        }
        location = /empty {
            empty_gif;
        }
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }

    }
}
</pre>
<p>Here is what you add to your main nginx mu install server conf:</p>
<pre>
    location ~* ^.+\.(jpg|jpeg|gif|png|xml|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
    {
   	access_log  /usr/local/nginx/logs/statics.access.log small;
        root /home/mu/public_html;
	if ($request_uri ~* "/ngimages" ) {
		error_page 404 = @ngimages;
	}
	rewrite ^/resize/files(/.*)$ /wp-content/blogs.dir/$host/files$1 last;
        rewrite ^/crop/files(/.*)$ /wp-content/blogs.dir/$host/files$1 last;
	rewrite ^/files(/.*)$ /wp-content/blogs.dir/$host/files$1 last;
        break;

    }
    location @ngimages {
        access_log  /usr/local/nginx/logs/ngimages.access.log small;
        proxy_read_timeout 10;
        proxy_cache_key $host$request_uri$args;
        proxy_cache_valid  200 304 7d;
        proxy_cache_valid  301 302 1h;
        proxy_cache_valid  404 403 402 401 504 502 20m;
        proxy_cache_valid  any 1m;
        proxy_cache two;
        proxy_set_header Host $http_host;
        rewrite ^/ngimages/(.*) /$1 break;
        proxy_pass http://127.0.0.1:81;
        }
</pre>
<p>wp-config at the bottom after abs path define and before require wp-settings:</p>
<pre>
if ( !defined('ABSPATH') )

	define('ABSPATH', dirname(__FILE__) . '/');

if ( !defined('WP_CONTENT_DIR') )
	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );

if( !defined( "UPLOADBLOGSDIR" ) )
	define( "UPLOADBLOGSDIR", 'wp-content/blogs.dir' );

if( !defined( "UPLOADS" ) )
	define( "UPLOADS", UPLOADBLOGSDIR . "/{$_SERVER['HTTP_HOST']}/files/" );

if( !defined( "BLOGUPLOADDIR" ) )
	define( "BLOGUPLOADDIR", WP_CONTENT_DIR . "/blogs.dir/{$_SERVER['HTTP_HOST']}/files/" );
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nginxphp.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nginxphp.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nginxphp.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nginxphp.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nginxphp.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nginxphp.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nginxphp.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nginxphp.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=13&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nginxphp.wordpress.com/2010/01/15/nginx-image-filter-module-mu-wordpress-conf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Faster Nginx WPMU Image Processing</title>
		<link>http://nginxphp.wordpress.com/2010/01/12/faster-nginx-wpmu-image-processing/</link>
		<comments>http://nginxphp.wordpress.com/2010/01/12/faster-nginx-wpmu-image-processing/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 09:25:39 +0000</pubDate>
		<dc:creator>honewatson</dc:creator>
				<category><![CDATA[Nginx PHP]]></category>
		<category><![CDATA[Nginx Wordpress]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[WPMU]]></category>

		<guid isPermaLink="false">http://nginxphp.wordpress.com/?p=10</guid>
		<description><![CDATA[I&#8217;ve been testing the Nginx Image Filter Module with WPMU.  So far it promises to save a lot of resources while delivering images for wpmu blogs at blistering speed. The file at /wp-content/blogs.php uses a tonne of unnecessary resources and Nginx Image Filter Module can easily save this problem. You need to set up two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=10&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been testing the Nginx Image Filter Module with WPMU.  So far it promises to save a lot of resources while delivering images for wpmu blogs at blistering speed.</p>
<p><span id="more-10"></span></p>
<p>The file at /wp-content/blogs.php uses a tonne of unnecessary resources and Nginx Image Filter Module can easily save this problem.</p>
<p>You need to set up two instances of Nginx.  One which servers files as per normal and another instance with serves images.</p>
<p>The main server proxy_pass the request and args to the nginx_image server which sends them back resized.  I will have a full write up soon but here is a preliminary setting for the Nginx Image Server.</p>
<p>This is the basic set up.  I have not included the key ingredient for the main nginx nginx.conf file.  More soon. </p>
<p>For image server set up extra nginx with this configure:</p>
<pre>
./configure --prefix=/usr/local/nginx_images --with-http_image_filter_module
make
make install
cp /etc/init.d/nginx  /etc/init.d/nginx_images
(change any setting in the file /etc/init.d/nginx_images from "/usr/local/nginx" to "/usr/local/nginx_images" )
</pre>
<p>Extra conf for image server.</p>
<pre>
location /img/ {
set $width $arg_w;
set $height $arg_h;
proxy_pass http://127.0.0.1:80;
image_filter   resize  $arg_w $arg_h;
    error_page     415   = /empty;
}
location = /empty {
    empty_gif;
}
</pre>
<p>wp_generate_attachment_metadata</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nginxphp.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nginxphp.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nginxphp.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nginxphp.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nginxphp.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nginxphp.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nginxphp.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nginxphp.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=10&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nginxphp.wordpress.com/2010/01/12/faster-nginx-wpmu-image-processing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
		<item>
		<title>Nginx PHP Configuration</title>
		<link>http://nginxphp.wordpress.com/2009/12/21/nginx-php-configuration/</link>
		<comments>http://nginxphp.wordpress.com/2009/12/21/nginx-php-configuration/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 23:37:33 +0000</pubDate>
		<dc:creator>honewatson</dc:creator>
				<category><![CDATA[Nginx Drupal]]></category>
		<category><![CDATA[Nginx PHP]]></category>
		<category><![CDATA[Nginx Wordpress]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://nginxphp.wordpress.com/?p=5</guid>
		<description><![CDATA[Nginx PHP Blog will cover in depth options for configuring Nginx with PHP and PHP based content management systems such as WordPress, Drupal, Joomla, Wikipedia and much much more.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=5&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Nginx PHP Blog will cover in depth options for configuring Nginx with PHP and PHP based content management systems such as WordPress, Drupal, Joomla, Wikipedia and much much more.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nginxphp.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nginxphp.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nginxphp.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nginxphp.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nginxphp.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nginxphp.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nginxphp.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nginxphp.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nginxphp.wordpress.com&amp;blog=11058454&amp;post=5&amp;subd=nginxphp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nginxphp.wordpress.com/2009/12/21/nginx-php-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4e9f5ca1121158385c9408cb2dafd03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">honewatson</media:title>
		</media:content>
	</item>
	</channel>
</rss>
