<?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>Computer Solutions Blog &#187; Tuning</title>
	<atom:link href="http://www.computersolutions.cn/blog/tag/tuning/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.computersolutions.cn/blog</link>
	<description>Whats happening at Computer Solutions</description>
	<lastBuildDate>Fri, 13 Jan 2012 02:32:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>NGinx and WordPress Crib Notes</title>
		<link>http://www.computersolutions.cn/blog/2009/11/nginx-and-wordpress-crib-notes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nginx-and-wordpress-crib-notes</link>
		<comments>http://www.computersolutions.cn/blog/2009/11/nginx-and-wordpress-crib-notes/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 11:08:04 +0000</pubDate>
		<dc:creator>Lawrence Sheed</dc:creator>
				<category><![CDATA[Technical Mumbo Jumbo]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[crib notes]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[Tuning]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.computersolutions.cn/blog/?p=260</guid>
		<description><![CDATA[Unfortunately, its back to the techie stuff for a few posts! Here are my crib notes on installing NGinx on one of our client servers. Add spawn-fcgi (cos its split from litettpd now) http://redmine.lighttpd.net/projects/spawn-fcgi/wiki/SVN cd /downloads svn co svn://svn.lighttpd.net/spawn-fcgi/trunk spawn-fcgi No svn..grrr apt-get install subversion subversion-tools svn co svn://svn.lighttpd.net/spawn-fcgi/trunk spawn-fcgi cd spawn-fcgi ./autogen.sh ./configure make [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately, its back to the techie stuff for a few posts!</p>
<p>Here are my crib notes on installing NGinx on one of our client servers.</p>
<p>Add spawn-fcgi (cos its split from litettpd now)<a href="http://redmine.lighttpd.net/projects/spawn-fcgi/wiki/SVN"> http://redmine.lighttpd.net/projects/spawn-fcgi/wiki/SVN</a></p>
<p><code><br />
cd /downloads<br />
svn co svn://svn.lighttpd.net/spawn-fcgi/trunk spawn-fcgi<br />
</code></p>
<p>No svn..grrr</p>
<p><code><br />
apt-get install subversion subversion-tools<br />
svn co svn://svn.lighttpd.net/spawn-fcgi/trunk spawn-fcgi<br />
cd spawn-fcgi<br />
./autogen.sh<br />
./configure<br />
make<br />
make install<br />
</code></p>
<p>spawn-fcgi should be happily installed in /usr/local/bin/spawn-fcgi now</p>
<p>make sure we have php5-cgi<br />
<code>apt-get install php5-cgi</code></p>
<p>Check spawn-fcgi runs -<br />
In my case not, had to rebuild eAccelerator @#$@#$!, did that, and all ok</p>
<p><code><br />
/bin/spawn-fcgi -f /usr/bin/php5-cgi -a 127.0.0.1 -p 53217 -P /var/run/fastcgi-php.pid<br />
</code></p>
<p>Note port 53217 can be any unused port from some high unused number though to 65535<br />
We&#8217;re going to be installing NGinx from debian packages, but probably better from source long term&#8230;</p>
<p><code>apt-get install nginx</p>
<p>pico /etc/nginx/nginx.conf<br />
</code></p>
<p>change some default settings</p>
<p><code><br />
user www-data;<br />
worker_processes  1;</p>
<p>error_log  /var/log/nginx/error.log;<br />
pid        /var/run/nginx.pid;</p>
<p>events {<br />
    worker_connections  1024;<br />
}</p>
<p>http {<br />
    include       /etc/nginx/mime.types;<br />
    default_type  application/octet-stream;</p>
<p>    access_log  /var/log/nginx/access.log;</p>
<p>    sendfile        on;<br />
    #tcp_nopush     on;</p>
<p>    #keepalive_timeout  0;<br />
    keepalive_timeout  5;<br />
    tcp_nodelay        on;</p>
<p>    client_max_body_size 8m;</p>
<p>    gzip  on;<br />
    gzip_comp_level 9;<br />
    gzip_types      text/plain text/html text/css text/xml application/xml application/xml+rss text/javascript application/x-javascript;</p>
<p>    include /etc/nginx/conf.d/*.conf;<br />
    include /etc/nginx/sites-enabled/*;<br />
}</p>
<p></code></p>
<p>Now we add our virtual hosts in  /etc/nginx/sites-available</p>
<p><code><br />
pico /etc/nginx/sites-available</p>
<p></code></p>
<p>Lastly, we add our fast-cgi settings, using our port from above 53217 </p>
<p><code><br />
fastcgi stuff here<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.computersolutions.cn/blog/2009/11/nginx-and-wordpress-crib-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speeding up Apache</title>
		<link>http://www.computersolutions.cn/blog/2009/03/speeding-up-apache/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=speeding-up-apache</link>
		<comments>http://www.computersolutions.cn/blog/2009/03/speeding-up-apache/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 06:14:54 +0000</pubDate>
		<dc:creator>Lawrence Sheed</dc:creator>
				<category><![CDATA[Technical Mumbo Jumbo]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Mod_Deflate]]></category>
		<category><![CDATA[Mod_Expires]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.computersolutions.cn/blog/?p=143</guid>
		<description><![CDATA[When I get time, I go through the logs and check out how the servers are doing. One thing that I haven&#8217;t really done recently is to optimize the way things are configured. The typical solution in most scenario&#8217;s is to throw faster hardware at things (something we do when necessary!), but sometimes a few [...]]]></description>
			<content:encoded><![CDATA[<p>When I get time, I go through the logs and check out how the servers are doing.</p>
<p>One thing that I haven&#8217;t really done recently is to optimize the way things are configured.<br />
The typical solution in most scenario&#8217;s is to throw faster hardware at things (something we do when necessary!), but sometimes a few minutes configuration can help speed things up tremendously.</p>
<p>Below are some tips for optimizing apache a little.</p>
<p><span id="more-143"></span></p>
<p>I&#8217;m going to assume you&#8217;re running apache2.  If not, why not?</p>
<p>First thing to do is to enable 2 modules.  Mod_Deflate and Mod_Expires</p>
<p>a2enmod deflate</p>
<p>a2enmod expires</p>
<p>Mod_Deflate is a nice Apache module that allows us to gzip files  when we send them to the browser.  This helps load times quite nicely &#8211; as network traffic is reduced.</p>
<p>In our systems Apache is over in /etc/apache2/<br />
The module configuration is done in mods-enabled</p>
<p>First up, we&#8217;ll configure Mod_Deflate.</p>
<p>pico /etc/apache2/mods-enabled/deflate.conf</p>
<p style="padding-left: 30px;">&lt;IfModule mod_deflate.c&gt;<br />
AddOutputFilterByType DEFLATE text/plain<br />
AddOutputFilterByType DEFLATE text/html<br />
AddOutputFilterByType DEFLATE text/xml<br />
AddOutputFilterByType DEFLATE text/css<br />
AddOutputFilterByType DEFLATE text/javascript<br />
AddOutputFilterByType DEFLATE application/xml<br />
AddOutputFilterByType DEFLATE application/xhtml+xml<br />
AddOutputFilterByType DEFLATE application/rss+xml<br />
AddOutputFilterByType DEFLATE application/javascript<br />
AddOutputFilterByType DEFLATE application/x-javascript<br />
AddOutputFilterByType DEFLATE application/x-httpd-php<br />
AddOutputFilterByType DEFLATE application/x-httpd-fastphp<br />
AddOutputFilterByType DEFLATE application/x-httpd-eruby<br />
AddOutputFilterByType DEFLATE image/svg+xml</p>
<p>DeflateCompressionLevel 9</p>
<p>BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
BrowserMatch bMSIEs(7|8) !no-gzip !gzip-only-text/html</p>
<p>SetEnvIf User-Agent &#8220;.*MSIE.*&#8221; nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0</p>
<p>&lt;/IfModule&gt;</p>
<p>I&#8217;ll go over what we&#8217;ve done below;</p>
<p>If you examine the file above, you&#8217;ll see that the first thing we do, is to check if mod_deflate is loaded with the IfModule directive.</p>
<p>We then setup compression for various file types -</p>
<p><strong>AddOutputFilterByType DEFLATE  &#8230;.</strong></p>
<p>While we can compress everything, and just exclude certain files, its usually safer to specify whats compressed.</p>
<p>We then set compression to maximum &#8211; computers these days have ample excess CPU, so its not really a concern anymore.</p>
<p><strong>DeflateCompressionLevel 9</strong></p>
<p>The next lines are to specify exceptions to the compression rules.  Ancient versions of Netscape don&#8217;t work so well with compression, so we disable it.  Internet Explorer also has a few issues also, so we setup an appropriate rule.</p>
<p><strong>BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
BrowserMatch bMSIEs(7|8) !no-gzip !gzip-only-text/html</strong></p>
<p>The last line is to force compatibility with older IE versions.  IE is a bit buggy, as we&#8217;ve noted.</p>
<p><strong>BrowserMatch bMSIEs(7|8) !no-gzip !gzip-only-text/html</strong></p>
<p>We&#8217;ll now check to see that we haven&#8217;t made any mistakes, and Apache2 runs ok.</p>
<p>apache2ctl configtest</p>
<p>If you see any errors, fix and retest.</p>
<p>Restart apache2</p>
<p>apache2ctl restart</p>
<p>Load up FireFox.  You&#8217;ll need to have some plugins installed to test.<br />
Go get FireBug, and YSlow, install and come back.</p>
<p>Done?</p>
<p>Ok, now open a page from the site, and click YSlow.</p>
<p>You should see now that the css, js, and php files are compressed with GZip.</p>
<p>Our next step is to setup Mod_Expires</p>
<p>pico /etc/apache2/mods-enabled/expires.conf</p>
<p style="padding-left: 30px;">&lt;IfModule mod_expires.c&gt;<br />
ExpiresActive On<br />
ExpiresByType image/gif A21600<br />
ExpiresByType image/jpeg A21600<br />
ExpiresByType text/css A21600<br />
ExpiresByType application/x-javascript A21600<br />
&lt;/IfModule&gt;</p>
<p>Essentially, what we&#8217;re doing above is turning on Content Expiry.  Content Expiry is the time that a browser will cache a file for before it reloads it.  For your average site things like images, javascript and css don&#8217;t change that much, so we can tell the browser to explicitly cache them.</p>
<p>The number next to the Expiry is the time that the file is valid for in seconds.<br />
(after that point, the browser should reload the file from the server).</p>
<p>In our setup above, we&#8217;ve set that images and css and javascript files should be kept for 6 hours.<br />
A21600 means &#8211; after 6hrs (60seconds x 60minutes x 6 = 21600)</p>
<p>I&#8217;d suggest using a low, but similar time span to avoid caching issues.  This would mostly affect website developers, rather than end users though, as they&#8217;re more likely to upload and change files frequently during testing.</p>
<p>Restart apache, and check again in YSlow / Firebug to see that the images and CSS are being cached.  If they are, congratulations, you&#8217;re done.</p>
<p>You should see a nice improvement on site load times, and things should feel snappier to end users.<br />
It will also reduce your server load, which is a nice benefit!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computersolutions.cn/blog/2009/03/speeding-up-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

