<?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>Web Server Hacks Blog - Hacks for Dedicated/VPS Servers, SSH, and Plesk &#187; Performance Tests</title>
	<atom:link href="http://webserverhacks.com/category/performance-tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://webserverhacks.com</link>
	<description>Hacks for Dedicated/VPS Servers, SSH, and Plesk</description>
	<lastBuildDate>Wed, 28 Jul 2010 17:59:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Ping Your Website Worldwide!</title>
		<link>http://webserverhacks.com/performance-tests/how-to-ping-your-website-worldwide/</link>
		<comments>http://webserverhacks.com/performance-tests/how-to-ping-your-website-worldwide/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 20:49:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance Tests]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[just ping]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[world]]></category>
		<category><![CDATA[worldwide]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=109</guid>
		<description><![CDATA[Just Ping is a service that will ping your website from various different locations in the world.  If you want to optimize your site and also wonder how fast it would load in other parts of the world, you can use Just Ping to do just that.
Another great feature is that you can also [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://just-ping.com/index.php" >Just Ping</a> is a service that will ping your website from various different locations in the world.  If you want to optimize your site and also wonder how fast it would load in other parts of the world, you can use Just Ping to do just that.</p>
<p>Another great feature is that you can also check the IP address being reported by various different points in the world.  What this does is helps you check DNS delegation status of your website during a DNS move.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/performance-tests/how-to-ping-your-website-worldwide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Run Lighttpd with Wordpress!</title>
		<link>http://webserverhacks.com/performance-tests/how-to-run-lighttpd-with-wordpress-on-plesk/</link>
		<comments>http://webserverhacks.com/performance-tests/how-to-run-lighttpd-with-wordpress-on-plesk/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 08:52:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance Tests]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[apache to lighttpd]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[run lighttpd]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=16</guid>
		<description><![CDATA[
In this blog post, I will show you how to convert a Wordpress blog to run Lighttpd instead of the default Apache Httpd server (on a Plesk server specifically). You can probably apply most of these instructions to any other web servers running on raw Apache but if you are that good at managing web [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-44 alignleft" title="lighttpd" src="http://webserverhacks.com/wp-content/uploads/2009/10/lighttpd.gif" alt="lighttpd" width="297" height="198" /></p>
<p>In this blog post, I will show you <strong>how to convert a Wordpress blog to run Lighttpd instead of the default Apache Httpd server (on a Plesk server specifically).</strong> You can probably apply most of these instructions to any other web servers running on raw Apache but if you are that good at managing web servers, I will leave the extra hacking to you. As for Plesk, I just find it easier to setup everything like e-mail, DNS, and whatnot but you don&#8217;t need to use Plesk at all if you can do it all using command-line.</p>
<p>In my recent conversions, my web servers are now able to handle about 2-3 times more web traffic than before using Lighttpd.</p>
<p>Before, my servers went down every couple days because of too much traffic.</p>
<p>Now, my servers &#8220;almost&#8221; never go down.</p>
<p>Btw, if you are not on a dedicated server or a VPS(such as MediaTemple), you can&#8217;t really install Lighttpd.  You need root access (or SSH) and full access to your web server in order to hack it to run Lighttpd.</p>
<p><strong>THIS GUIDE HAS BEEN TESTED ON THE FOLLOWING WEB HOSTING AND HARDWARE:</strong></p>
<p><strong>MediaTemple dv servers running CentOS, SingleHop Dedicated servers running CentOS64, and Cari.Net dedicated servers running Fedora.  (All servers setup with basic Plesk)</strong></p>
<p><a target="_blank" href="http://www.lighttpd.net/" >Lighttpd</a> is a web server designed to handle large amounts of web traffic.  Before, I suffered from bad Httpd servers that would just start showing empty web pages, mainly due to lack of server memory.  After switching to Lighttpd, my server&#8217;s memory use was about 10 times more efficient.</p>
<p>First, you will need to install some dependencies in order to use Lighttpd right.  There&#8217;s simpler ways of installing Lighttpd such as apt-get, yum, or RPM but do not do that as you will actually have to compile the source code. (in order for mod_magnet to work, which is crucial for Wordpress permalinks and WP-Super Cache to work.  If you don&#8217;t need those, then go ahead.)</p>
<h2>1.Installing Pkgconfig</h2>
<p>First you will need to download Pkgconfig to install mod_magnet, which basically is a Lighttpd module that can enable permalinks and mod redirects.  Now, follow my directions as there&#8217;s other ways to do it on the web but THEY DON&#8217;T WORK! (hence the point of this blog post)</p>
<p><a target="_blank" href="http://pkgconfig.freedesktop.org/releases/" >Download latest version of Pkgconfig</a> (This is needed for mod_magnet installation without errors.)</p>
<p>Use wget command to download the latest pkgconfig:</p>
<blockquote><p>wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz</p></blockquote>
<p>Use tar to uncompress the file:</p>
<blockquote><p>tar xvf pkg-config-0.23.tar.gz</p></blockquote>
<p>Go into the directory of Pkgconfig:</p>
<blockquote><p>cd pkg-config-0.23</p></blockquote>
<p>Compile:</p>
<blockquote><p>./configure</p>
<p>make</p>
<p>make install</p>
<p>cd ..</p></blockquote>
<p>You should get a bunch of messages that everything has been installed correctly.</p>
<h2>2.Installing Lua</h2>
<p>You will also need to download latest version of Lua for mod_magnet to be installed correctly.</p>
<p><a target="_blank" href="http://www.lua.org/ftp/" >Download latest version of Lua</a> (This is needed for mod_magnet)</p>
<p>Use wget command to download the latest Lua:</p>
<blockquote><p>wget http://www.lua.org/ftp/lua-5.1.4.tar.gz</p></blockquote>
<p>Use tar to uncompress the file:</p>
<blockquote><p>tar xvf lua-5.1.4.tar.gz</p></blockquote>
<p>Go into the directory of Lua:</p>
<blockquote><p>cd lua-5.1.4</p></blockquote>
<p>Use the following command for compiling:<br />
(These instructions are for either Fedora or CentOS, if you are on different linux OS, you will need to read the README)</p>
<blockquote><p>make linux</p></blockquote>
<p><span style="color: #ff0000;">*Note: If you get readline errors, try: (that means you don&#8217;t have readline development packages installed)<br />
</span></p>
<blockquote><p><span style="color: #ff0000;">yum install readline-devel</span></p></blockquote>
<p><span style="color: #ff0000;">*Note: If you get errors like this &#8220;/usr/bin/ld: cannot find -lncurses&#8221;, try:</span></p>
<blockquote><p><span style="color: #ff0000;">yum install ncurses-devel</span></p></blockquote>
<p>If everything goes well, do make install:</p>
<blockquote><p>make install</p></blockquote>
<p>Next, copy lua.pc to /usr/lib/pkgconfig where your pkgconfig is installed:</p>
<blockquote><p>cp etc/lua.pc /usr/lib/pkgconfig</p></blockquote>
<p>Do ranlib command:</p>
<blockquote><p>ranlib src/liblua.a</p></blockquote>
<p>Back to working directory:</p>
<blockquote><p>cd ..</p></blockquote>
<h2>3. Installing Lighttpd</h2>
<p>Hopefully you got steps 1 and 2 right, make sure you do because otherwise you won&#8217;t be able to compile Lighttpd correctly.  Trust me, I did this for like 2 days without sleep before getting it right.  The instructions on the web are all either vague or hard to follow so just follow my directions and you can do it.</p>
<p>Now for the fun part, download the latest version of Lighttpd:</p>
<p><a target="_blank" href="http://www.lighttpd.net/download" >Download latest version of Lighttpd HERE</a></p>
<p>Use wget command to download the latest Lighttpd:</p>
<blockquote><p>wget http://www.lighttpd.net/download/lighttpd-1.4.23.tar.gz</p></blockquote>
<p>Use tar to uncompress the file:</p>
<blockquote><p>tar xvf lighttpd-1.4.23.tar.gz</p></blockquote>
<p>Go into the directory of Lua:</p>
<blockquote><p>cd lighttpd-1.4.23</p></blockquote>
<p>Use the following command to configure package for compiling:</p>
<blockquote><p>./configure &#8211;with-lua PKG_CONFIG_PATH=/usr/lib/pkgconfig</p></blockquote>
<p><span style="color: #0000ff;">Note: Errors you might encounter:</span></p>
<p><span style="color: #0000ff;">Error:<br />
</span></p>
<blockquote><p><span style="color: #0000ff;">configure: error: pcre-config not found, install the pcre-devel package or build with &#8211;without-pcre</span></p></blockquote>
<p><span style="color: #0000ff;">Solution:<br />
</span></p>
<blockquote><p><span style="color: #0000ff;">yum install pcre-devel</span></p></blockquote>
<p><span style="color: #0000ff;">Error:<br />
</span></p>
<blockquote><p><span style="color: #0000ff;">configure: error: zlib-headers and/or libs where not found, install them or build with &#8211;without-zlib</span></p></blockquote>
<p><span style="color: #0000ff;">Solution:<br />
</span></p>
<blockquote><p><span style="color: #0000ff;">yum install zlib-devel</span></p></blockquote>
<p><span style="color: #0000ff;">Error:<br />
</span></p>
<blockquote><p><span style="color: #0000ff;">configure: error: bzip2-headers and/or libs where not found, install them or build with &#8211;without-bzip2</span></p></blockquote>
<p><span style="color: #0000ff;">Solution:<br />
</span></p>
<blockquote><p><span style="color: #0000ff;">yum install bzip2-devel</span></p></blockquote>
<p>Compile</p>
<blockquote><p>make</p>
<p>make install</p></blockquote>
<p><span style="color: #ff0000;">*Note: You might get errors with a 64bit system as I did with a CentOS64 </span></p>
<p><span style="color: #ff0000;">ERRORS with CentOS 64:</span></p>
<blockquote><p><span style="color: #ff0000;">libtool: link: gcc -shared  .libs/mod_magnet_la-mod_magnet.o .libs/mod_magnet_la-mod_magnet_cache.o   -L/usr/local/lib -llua -lm    -Wl,-soname -Wl,mod_magnet.so -o .libs/mod_magnet.so<br />
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_&#8217; can not be used when making a shared object; recompile with -fPIC</span></p></blockquote>
<p><span style="color: #ff0000;">If you get this you need to re-compile Lua again, go back to the Lua source directory:</span></p>
<blockquote><p><span style="color: #ff0000;">cd lua-5.1.4</span></p>
<p><span style="color: #ff0000;">vi src/Makefile</span></p></blockquote>
<p><span style="color: #ff0000;">Change this line:</span></p>
<blockquote><p><span style="color: #ff0000;">CFLAGS= -O2 -Wall $(MYCFLAGS)</span></p></blockquote>
<p><span style="color: #ff0000;">to this:</span></p>
<blockquote><p><span style="color: #ff0000;">CFLAGS= -O2 -Wall $(MYCFLAGS) -fPIC</span></p></blockquote>
<p><span style="color: #ff0000;"><br />
</span></p>
<p><span style="color: #ff0000;">Compile Lua again using &#8220;make linux&#8221; and &#8220;make install&#8221;, then go back to installing lighttpd.<br />
*You might have to do &#8220;make clean&#8221; before compiling to clean up previous compiles.<br />
</span></p>
<p>You shoud be DONE with compiling/installing Lighttpd here but you still need to setup the config files so that&#8217;s next.</p>
<h2>4. Setting up Lighttpd.conf, web server directory, and Wordpress permalinks + WP Super Cache</h2>
<p>The following steps are necessary for running your website correctly which includes setting your web server directory, Wordpress permalinks, and WP Super Cache with Lighttpd mod_magnet module.</p>
<p>First, make a directory called lighttpd under /etc like this:</p>
<blockquote><p>mkdir /etc/lighttpd</p></blockquote>
<p>Next, copy the defauly lighttd.conf file from your uncompressed Lighttpd directory under /doc.</p>
<blockquote><p>cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf</p></blockquote>
<p>Next, use vi to edit the file. (Or you can use your favorite text editor):</p>
<blockquote><p>vi /etc/lighttpd/lighttpd.conf</p></blockquote>
<p>Uncomment (or add if it doesn&#8217;t exist) the following lines.</p>
<blockquote><p>&#8220;mod_fastcgi&#8221;,<br />
&#8220;mod_magnet&#8221;,</p></blockquote>
<p>Set the server.document-root directory to <strong>/var/www/html/</strong> (or your web server directory):</p>
<blockquote><p>server.document-root        = &#8220;/var/www/html/&#8221;</p></blockquote>
<p>If you are doing this on a live server, you might want to test Lighttpd on server port 81 before you actually make it go live so you don&#8217;t mess with the live website:</p>
<p>For testing on a live server, change server.port to 81: (Remember to change this back to port 80 when going live)</p>
<blockquote><p>server.port                = 81</p></blockquote>
<p>Find where the following lines are:</p>
<blockquote><p>#simple-vhost.server-root   = &#8220;/srv/www/vhosts/&#8221;<br />
#simple-vhost.default-host  = &#8220;www.example.org&#8221;<br />
#simple-vhost.document-root = &#8220;/htdocs/</p></blockquote>
<p>Under it, add something like this:</p>
<blockquote><p>$HTTP["host"] =~ &#8220;(^|\.)mysite\.com$&#8221; {<br />
server.document-root = &#8220;/var/www/vhosts/mysite.com/httpdocs&#8221;<br />
server.errorlog = &#8220;/var/log/lighttpd/error.log&#8221;<br />
accesslog.filename = &#8220;/var/log/lighttpd/access.log&#8221;<br />
server.error-handler-404 = &#8220;/var/www/vhosts/mysite.com/error_docs/not_found.html&#8221;</p>
<p>magnet.attract-physical-path-to = ( server.document-root + &#8220;/rewrite.lua&#8221; )</p>
<p>}</p></blockquote>
<p>Remember, this example is for Plesk web servers where the web directory is usually under <strong>/var/www/vhosts</strong>.  If you are not using Plesk, use your own directory.</p>
<p>Now, *IMPORTANT*, uncomment the following lines:</p>
<blockquote><p>#### fastcgi module<br />
## read fastcgi.txt for more info<br />
## for PHP don&#8217;t forget to set cgi.fix_pathinfo = 1 in the php.ini<br />
fastcgi.server             = ( &#8220;.php&#8221; =&gt;<br />
( &#8220;localhost&#8221; =&gt;<br />
(<br />
&#8220;socket&#8221; =&gt; &#8220;/var/run/lighttpd/php-fastcgi.socket&#8221;,<br />
&#8220;bin-path&#8221; =&gt; &#8220;/usr/local/bin/php-cgi&#8221;<br />
)<br />
)<br />
)</p></blockquote>
<p>Change 2 above lines(parameters) to:</p>
<blockquote><p>&#8220;socket&#8221; =&gt; &#8220;/tmp/php-fastcgi.socket&#8221;,<br />
&#8220;bin-path&#8221; =&gt; &#8220;/usr/bin/php-cgi&#8221;</p></blockquote>
<p>You can also optimize the above section of code for number of children and max request but you can do this after you have verified Lighttpd has been installed correctly, so skip this step and come back.</p>
<p><strong>(Optimizing)<br />
</strong></p>
<p><strong>For optimizing add: (<a target="_blank" href="http://redmine.lighttpd.net/projects/1/wiki/FrequentlyAskedQuestions" >see here for optimizing</a>)</strong></p>
<blockquote><p><strong>&#8220;PHP_FCGI_CHILDREN&#8221; =&gt; &#8220;16&#8243;,<br />
&#8220;PHP_FCGI_MAX_REQUESTS&#8221; =&gt; &#8220;10000&#8243;,</strong></p></blockquote>
<p>Next, you will need to add a file called &#8220;rewrite.lua&#8221; to the root directory of your Wordpress blog installation:</p>
<p>Copy and paste the following lines and save as &#8220;rewrite.lua&#8221; for each of your Wordpress blogs hosted on this server.  (Sometimes copying and pasting might corrupt the apostrophes so make sure you copy them exactly!)</p>
<blockquote><p>function serve_html(cached_page)<br />
if (lighty.stat(cached_page)) then<br />
lighty.env["physical.path"] = cached_page<br />
print(&#8221;Serving cached page: &#8221; .. cached_page)<br />
return true<br />
else<br />
return false<br />
end<br />
end</p>
<p>function serve_gzip(cached_page)<br />
if (lighty.stat(cached_page .. &#8220;.gz&#8221;)) then<br />
lighty.header["Content-Encoding"] = &#8220;gzip&#8221;<br />
lighty.header["Content-Type"] = &#8220;&#8221;<br />
lighty.env["physical.path"] = cached_page .. &#8220;.gz&#8221;<br />
print(&#8221;Serving gzipped page: &#8221; .. cached_page .. &#8220;.gz&#8221;)<br />
return true<br />
else<br />
return false<br />
end<br />
end</p>
<p>attr = lighty.stat(lighty.env["physical.path"])</p>
<p>if (not attr) then<br />
lighty.env["uri.path"] = &#8220;/index.php&#8221;<br />
lighty.env["physical.rel-path"] = lighty.env["uri.path"]<br />
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]</p>
<p>query_condition = not (lighty.env["uri.query"] and string.find(lighty.env["uri.query"], &#8220;.*s=.*&#8221;))<br />
user_cookie = lighty.request["Cookie"] or &#8220;no_cookie_here&#8221;<br />
cookie_condition = not (string.find(user_cookie, &#8220;.*comment_author.*&#8221;) or string.find(user_cookie, &#8220;.*wordpress.*&#8221;) or string.find(user_cookie, &#8220;.*wp-postpass_.*&#8221;))<br />
if (query_condition and cookie_condition) then<br />
accept_encoding = lighty.request["Accept-Encoding"] or &#8220;no_acceptance&#8221;<br />
cached_page = lighty.env["physical.doc-root"] .. &#8220;/wp-content/cache/supercache/&#8221; .. lighty.request["Host"] .. lighty.env["request.uri"] .. &#8220;/index.html&#8221;<br />
cached_page = string.gsub(cached_page, &#8220;//&#8221;, &#8220;/&#8221;)<br />
if (string.find(accept_encoding, &#8220;gzip&#8221;)) then<br />
if not serve_gzip(cached_page) then serve_html(cached_page) end<br />
else<br />
serve_html(cached_page)<br />
end<br />
end<br />
end</p></blockquote>
<p>Now, change /etc/php.ini and add the following line somewhere at the top:</p>
<blockquote><p>cgi.fix_pathinfo = 1</p></blockquote>
<p>Also, make sure SAFE MODE in Php.ini is TURNED OFF:</p>
<blockquote><p>;<br />
; Safe Mode<br />
;<br />
safe_mode = Off</p></blockquote>
<p>Also, you need to turn on compression if you want glib compression:</p>
<blockquote><p>zlib.output_compression = 9</p></blockquote>
<p>Next, we need to make a directory called &#8220;<strong>lighttpd</strong>&#8221; for logging errors under <strong>/var/log</strong> directory like this:</p>
<blockquote><p>mkdir /var/log/lighttpd</p></blockquote>
<h2>5. Starting Lighttpd for the first time</h2>
<p>Now, try to start your Lighttpd with the following command:</p>
<blockquote><p>/usr/local/sbin/lighttpd start -f /etc/lighttpd/lighttpd.conf</p></blockquote>
<p>Now try doing a &#8220;top&#8221; command and press &#8220;M&#8221; while in top, you should see bunch of <strong>php-fcgi processes</strong> and o<strong>ne Lighttpd process</strong>.  If that&#8217;s the case, congratulations, your web server is now running Lighttpd.  You can also test your website on port 81 by doing http://mysite.com:81.</p>
<p>Now, you will actually need to test it on your live blog to make sure it&#8217;s working.</p>
<p>Kill the Lighttpd process by:</p>
<blockquote><p>Kill {lighttpd PID}</p></blockquote>
<p>You can find Lighttpd PID while doing the top command.</p>
<p>Go back to editing the file /etc/lighttpd/lighttpd.conf and change the following line:</p>
<blockquote><p>server.port                = 81</p></blockquote>
<p>to</p>
<blockquote><p>server.port                = 80</p></blockquote>
<p>Next, we will stop the live website intermittently and bring up Lighttpd immediately to start running your websites:</p>
<p>It&#8217;s pretty simple to do as you can shut down your Apache by doing:</p>
<blockquote><p>/sbin/service httpd stop</p></blockquote>
<p>Then do:</p>
<blockquote><p>/usr/local/sbin/lighttpd start -f /etc/lighttpd/lighttpd.conf</p></blockquote>
<p>Immediately check to see if your Wordpress blog is running correctly.  If not, simply kill the Lighttpd process like before and start the httpd server so your live site keeps running:</p>
<blockquote><p>/sbin/service httpd start</p></blockquote>
<p>If you are having problems at this point, you might want to go check the errors listed under <strong>/var/log/lighttpd</strong>.</p>
<p>Most likely, you will probably have some kind of setup config file error so just double check it, keep testing the lighttpd until your live site runs flawlessly.</p>
<p>Of course, it&#8217;s best if you can practice this before running on a live site so&#8230;</p>
<p>If you have gotten the test to run right, let&#8217;s move on.</p>
<p>Next, we need to set up Lighttpd so the web server will only use Lighttpd to run your Wordpress blogs. (and we can turn off resource-wasting Apache)</p>
<h2>6. Replacing Apache Httpd permanently with Lighttpd</h2>
<p>copy the init.d script from lighttpd-1.x.xx/doc directory to /etc/init.d/lighttpd</p>
<p><em>for redhat or fedora or CentOS (tested on those):</em></p>
<blockquote><p>cp /root/lighttpd-1.4.23/doc/rc.lighttpd.redhat /etc/init.d/lighttpd</p></blockquote>
<p><em>try this one if above doesn&#8217;t work:</em></p>
<blockquote><p>cp /root/lighttpd-1.4.23/doc/rc.lighttpd /etc/init.d/lighttpd</p></blockquote>
<p>Copy the Lighttpd executable file from /usr/local/sbin/lighttpd to /usr/sbin.  Trust me, just do it.</p>
<p>cp /usr/local/sbin/lighttpd /usr/sbin/.</p>
<p>Now, do the following commands to add lighttpd to your starting processes. (so your Lighttpd will automatically run if web server is rebooted)</p>
<blockquote>
<pre><code><span style="font-weight: bold;">chkconfig <span style="color: #000099;">lighttpd</span> <span style="color: #990000;">--add</span></span>
<span style="font-weight: bold;">chkconfig  lighttpd  <span style="color: #990000;">on</span>
</span></code></pre>
</blockquote>
<p>Now, let&#8217;s turn off Apache&#8217;s httpd so it doesn&#8217;t run (ever) again:</p>
<blockquote>
<pre><code><span style="font-weight: bold;">chkconfig <span style="color: #000099;">httpd</span> <span style="color: #990000;">off</span></span></code></pre>
</blockquote>
<p>Now, check to see if httpd is NOT supposed to start automatically.   It probably is turned off.  Just making sure, double check.</p>
<blockquote>
<pre><code><span style="font-weight: bold;">chkconfig <span style="color: #000099;">--list</span></span></code></pre>
</blockquote>
<h2>A. Errors and Solutions</h2>
<p>If lighttpd cannot be found via ps -ax|grep lighttpd</p>
<p>Try:</p>
<blockquote><p>cp /usr/local/sbin/lighttpd /usr/sbin/.<br />
/etc/init.d/lighttpd start</p></blockquote>
<p>If it starts fine, you are done!</p>
<p><strong>VERY IMPORTANT &#8211; Also make sure to set your WP Super Cache directory to 777!</strong></p>
<blockquote><p>chmod 777 cache</p></blockquote>
<p>Usually your cache directory is under <strong>myblog/wp-content/cache</strong></p>
<p>Error:</p>
<blockquote><p>2009-08-24 18:53:32: (log.c.124) opening errorlog &#8216;/var/log/lighttpd/error.log&#8217; failed: No such file or directory</p>
<p>2009-08-24 18:53:32: (server.c.919) Opening errorlog failed. Going down.</p></blockquote>
<p>Try:</p>
<blockquote><p>Make sure you made a new directory /var/log/lighttpd</p></blockquote>
<h2>B. Performance Test</h2>
<p>I did a performance test while converting couple of my high-trafficked blogs from Apache to Lighttpd:</p>
<p>Used the ab command:</p>
<blockquote><p><strong>ab -n 1000 -c 5 http://testsite.com/index.php</strong></p></blockquote>
<p>Results:</p>
<p><strong>Load Avg. Httpd &#8211; 0.70</strong></p>
<p><strong>Load Avg. Lighttpd &#8211; 0.34</strong></p>
<p>That&#8217;s a whopping 200% improvement in load times!</p>
<p><strong>Blog A</strong></p>
<p><span style="color: #ff0000;">Httpd Home page loading time &#8211; 0.774 seconds</span></p>
<p><span style="color: #ff0000;">Httpd Avg. single page load time &#8211; 1.1  seconds</span></p>
<p><span style="color: #0000ff;">Lighttpd Home page loading time &#8211; 0.74 seconds</span></p>
<p><span style="color: #0000ff;">Lighttpd Avg. single page load time -</span></p>
<p><span style="color: #ff0000;">Httpd Ab test &#8211; 28.52 [#/sec] (mean)</span></p>
<p><span style="color: #0000ff;">Lighttpd Ab test &#8211; 38.34 [#/sec] (mean)</span></p>
<p><strong>Blog B</strong></p>
<p><span style="color: #ff0000;">Httpd Home page loading time &#8211; 0.375 seconds</span></p>
<p><span style="color: #ff0000;">Httpd Avg. single page load time &#8211; 0.42 seconds</span></p>
<p><span style="color: #0000ff;">Lighttpd Home page loading time &#8211; 0.344 seconds</span></p>
<p><span style="color: #0000ff;">Lighttpd Avg. single page load time &#8211; 0.39 seconds</span></p>
<p><span style="color: #ff0000;">Httpd Ab test &#8211; 77.54 [#/sec] (mean)</span></p>
<p><span style="color: #0000ff;">Lighttpd Ab test &#8211; 108.09 [#/sec] (mean)</span></p>
<h2>FINAL THOUGHTS</h2>
<p>I actually wrote this HOWTO guide about 3 months ago.  After 3 months of extensive testing on millions of pageviews, Lighttpd has proved to be much better solution for high-trafficked Wordpress blogs.</p>
<p>If you are not dealing with much web traffic (less than 5,000/pageviews per day), you might be better off Apache since it&#8217;s easier to use.</p>
<p>For all others who are spending at least $100/month on dedicated/VPS web hosting services, you can expect to shave about half of your web hosting costs.</p>
<p>My web hosting costs went down from $1500 a month to $600 because my web servers now can handle 2-3 times more traffic.  Over a year, that&#8217;s about $8,000 in savings.  It made enough of a difference where I could use the money saved for other things in my blogging business.</p>
<p>Why did I made this free tutorial?</p>
<p>Basically to help you save money on web server costs.  At first, I was even thinking of selling my HOWTO guide but then heck, I am a blogger.  I feel I need to give back to the community (the interwebs).</p>
<p>Anyways, if you have trouble with this HOWTO guide, simply leave a comment and I will try to help you as best as I can.  Sometimes, it might take me over a week to reply as I am constantly working on things. (and blogging)  But if it&#8217;s emergency or you simply can do it yourself, I can help you to setup your site for a fee.  You can e-mail me @ zedomax [at] gmail.com for a quote.</p>
<p>Enjoy hacking and I hope you save a bunch of money on dedicated/VPS web hosting costs.</p>
<h2>EXTRA &#8211; /etc/lighttpd/lighttpd.conf settings for MediaWiki installation on /wiki directory</h2>
<p>Add the following to lighttpd.conf</p>
<blockquote><p>url.rewrite-once = (<br />
&#8220;(^/wiki/[^:]*[\./].*)&#8221; =&gt; &#8220;$1&#8243;,<br />
&#8220;^/wiki/([^?]*)(?:\?(.*))?&#8221; =&gt; &#8220;/wiki/index.php?title=$1&amp;$2&#8243;,<br />
)</p></blockquote>
<p>For LocalSettings.php in MediaWiki, try:</p>
<blockquote><p>$wgScriptPath       = &#8220;/wiki&#8221;;</p>
<p>$wgScript           = &#8220;$wgScriptPath/index.php&#8221;;<br />
$wgRedirectScript   = &#8220;$wgScriptPath/redirect.php&#8221;;</p>
<p>$wgUsePathInfo = false;</p></blockquote>
<h2>More Resources</h2>
<ul>
<li><a target="_blank" href="http://webserverhacks.com/performance-tests/wordpress-lighttpd-vs-apache-httpd-perfomance-test/" >Initial Performance Test between Apache Httpd and Lighttpd</a></li>
<li><a target="_blank" href="http://www.tweako.com/how_to_install_lighttpd_with_php5_and_mysql_support_on_centos_5_0" >How to Install Lighttpd with PHP5 and Mysql on CentOS 5</a></li>
<li><a target="_blank" href="http://cloudservers.mosso.com/index.php/CentOS_-_chkconfig#I.27ve_got_an_init_script_but_its_not_listed_in_chkconfig" >Chkconfig HOWTO</a> setup for automated startup for services.</li>
<li><a target="_blank" href="http://forum.lighttpd.net/topic/277" >Ubuntu Startup Script</a></li>
<li><a target="_blank" href="http://linux.about.com/library/cmd/blcmdl8_chkconfig.htm" >Chkconfig command details on About.com</a></li>
</ul>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 3795px; width: 1px; height: 1px;"><strong>ab -n 1000 -c 5 http://testsite.com/index.php</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/performance-tests/how-to-run-lighttpd-with-wordpress-on-plesk/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Wordpress Lighttpd vs. Apache Httpd Perfomance Test</title>
		<link>http://webserverhacks.com/performance-tests/wordpress-lighttpd-vs-apache-httpd-perfomance-test/</link>
		<comments>http://webserverhacks.com/performance-tests/wordpress-lighttpd-vs-apache-httpd-perfomance-test/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 22:22:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance Tests]]></category>
		<category><![CDATA[ab]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=4</guid>
		<description><![CDATA[This is a Wordpress permance test using Lighttpd (which is a faster alternative to Apache) and Apache Httpd on a test server loaded with a real blog.  All tests were done from empty load of zero.
For testing, I&#8217;ve used a virtual dedicated server from MediaTemple, specifically their dv Extreme server which touts 2GB of ram [...]]]></description>
			<content:encoded><![CDATA[<p>This is a Wordpress permance test using <a target="_blank" href="http://www.lighttpd.net/" >Lighttpd</a> (which is a faster alternative to Apache) and <a target="_blank" href="http://www.apache.org/" >Apache Httpd</a> on a test server loaded with a real blog.  All tests were done from empty load of zero.</p>
<p>For testing, I&#8217;ve used a virtual dedicated server from <a target="_blank" href="http://webserverhacks.com/go/mediatemple" >MediaTemple</a>, specifically their dv Extreme server which touts 2GB of ram and virtual quad-core CPU performance.</p>
<p>I did an initial test with Lighttpd and  found that <strong>Lighttpd outperforms Apache Httpd by 2-10 times faster on images.</strong> If you have a blog with image on every blog post, you can probably expect a lot of performance improvements in loading times and also be able to handle 2-10 times more traffic from the same hardware.</p>
<p>The below are my test results on a test server loaded with real-world blog with 28MB of MySQL database and 30KB image on every blog post with about 80KB of images on the homepage, which is the page this test is based on.</p>
<p>Total bytes of the test blog homepage is 129KB.</p>
<p>For all tests, <a target="_blank" href="http://wordpress.org/extend/plugins/wp-super-cache/" >Wordpress Super Cache plugin</a> and Super Cache Glib Compression (Php.ini zlib.output_compression = 9) was turned on.</p>
<p>For Lighttpd, there were 2 different versions of mod rewrite to make Super Cache work:</p>
<ul>
<li>Lighttpd with Mod_Rewrite and Mod_Magnet based on <a target="_blank" href="http://www.asteriosk.gr/blog/2009/02/19/installing-wp-super-cache-with-lighttpd/" >asteriosk.gr method</a>.  This method supposedly improves upon the Tempe.st method  below but I did not notice any performance improvements.</li>
<li>Lighttpd with Mod_Magnet based on <a target="_blank" href="http://tempe.st/2008/05/lightning-speed-wordpress-with-lighttpd-and-supercache-part-ii/" >Tempe.st method</a>.  This uses Lighttpd coupled with Mod_Magnet module, which is Lighttpd substitute/alternative to Apache&#8217;s mod rewrite .htaccess file.</li>
</ul>
<p>I&#8217;ve used the following <a target="_blank" href="http://linux.die.net/man/1/ab" >ab</a> parameters, 1000 connections with 5 concurrent connections.</p>
<p><strong>ab -n 1000 -c 5 http://testsite.com/index.php</strong></p>
<h2>Here&#8217;s test results for Apache Httpd</h2>
<p>Only PHP was enabled for Apache, everything else turned off.  PHP and Httpd were both optimized as much  as they can be.</p>
<p><strong>Max Load: 6.37</strong></p>
<p><strong>Max Memory: 337MB</strong><br />
Time taken for tests:   86.480747 seconds<br />
<strong>Requests per second:    11.56 [#/sec] (mean)<br />
</strong>Time per request:       432.404 [ms] (mean)<br />
Time per request:       86.481 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          3.33 [Kbytes/sec] received</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50%    378<br />
66%    442<br />
75%    501<br />
80%    542<br />
90%    657<br />
95%    737<br />
98%    908<br />
99%   1039<br />
100%   2112 (longest request)</p>
<h2>Lighttpd with Mod_Rewrite and Mod_Magnet</h2>
<p>based on <a target="_blank" href="http://www.asteriosk.gr/blog/2009/02/19/installing-wp-super-cache-with-lighttpd/" >asteriosk.gr method</a>.</p>
<p><strong>Max Load: 3.04</strong></p>
<p><strong>Max Memory: 264MB</strong></p>
<p>Time taken for tests:   81.85927 seconds<br />
<strong>Requests per second:    12.33 [#/sec] (mean)</strong><br />
Time per request:       405.430 [ms] (mean)<br />
Time per request:       81.086 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          3.33 [Kbytes/sec] received</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50%    323<br />
66%    456<br />
75%    517<br />
80%    535<br />
90%    637<br />
95%    738<br />
98%    917<br />
99%   1001<br />
100%   1357 (longest request)</p>
<h2>Lighttpd with Mod_Magnet</h2>
<p>based on <a target="_blank" href="http://tempe.st/2008/05/lightning-speed-wordpress-with-lighttpd-and-supercache-part-ii/" >Tempe.st method</a>.</p>
<p><strong>Max Load: 3.00</strong></p>
<p><strong>Max Memory: 261MB</strong></p>
<p>Time taken for tests:   82.267440 seconds<br />
<strong>Requests per second:    12.16 [#/sec] (mean)<br />
</strong>Time per request:       411.337 [ms] (mean)<br />
Time per request:       82.267 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          3.28 [Kbytes/sec] received</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50%    339<br />
66%    416<br />
75%    516<br />
80%    546<br />
90%    673<br />
95%    777<br />
98%    863<br />
99%    952<br />
100%   1184 (longest request)</p>
<p>For Lighttpd, I did 2 different versions that were currently available out there for working with Wordpress Super Cache&#8217;s mod rewrite code.</p>
<p>I found that the Lighttpd in general was faster, memory fluctuated at 250-265MB, and maximum load was at about 3.0 during the testing. (for both Lighttpd versions, I saw negligence in improvement of performance between the 2 codes)</p>
<p>In contrast, the Apache Httpd was much more slower and gobbled up memory.  The Httpd reached about the double load of Lighttpd at 6.37, memory kept rising from cold start 250MB to 337MB until the end of the ab test.</p>
<h2>Conclusion</h2>
<p>Lighttpd is more efficient with memory, the test server at zero load used up about 250MB of memory.  During the testing, Lighttpd never used more than 6MB of memory at max  while Httpd used 87MB of memory.  That&#8217;s about 87/6= 14.5 times better use of memory by Lighttpd.</p>
<p>For server load, I noticed that Lighttpd reached load of about 3.0 but when the test was over, the server load came down very quickly in comparison to Apache Httpd, which reached load of 6.37 and took a lot longer for the load to settle.</p>
<p>For those of you who need friendly permalinks and Wordpress Super Cache, my advice is to go with the Lighttpd with Mod_Magnet based on <a target="_blank" href="http://tempe.st/2008/05/lightning-speed-wordpress-with-lighttpd-and-supercache-part-ii/" >Tempe.st method</a>.  It seemed that this is the simplest method to make it work since you don&#8217;t need any hardcoded code.</p>
<p>I will have a step-by-step instructions on how to convert your existing Plesk server to run Lighttpd so watch out for that next.</p>
<p>Using Lighttpd could possibly save you thousands of dollars on server fees as your website will be able to handle more web traffic (possible 2-10 times more!) and your site will load much faster, meaning your blog readers/visitors will enjoy the blog more.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">ab -c 1000 -n 5 http://doyoureallywant.com/index.php</div>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/performance-tests/wordpress-lighttpd-vs-apache-httpd-perfomance-test/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
