WordPress Super Cache on lighttpd

While trying to speed up Select Articles, I got stuck, torn in between WP Super Cache and lighttpd. Already we at Saturn are using lighttpd on several dedicated servers, and know the potential and benefit of having this over Apache though the flexiblity of having a perdirectory configuration at the programmers choice was a big question. A quick search on the Google landed me to a technical blog, notepad and personal web page by Asterios Katsifodimos.

Trying to get WP Super Cache & WordPress working on my fast lighttpd server, I came into problems, mainly because of lighttpd’s lack of (Apache’s version of) the mod_rewrite module. The static files that were created from the cache were not statically served from wordpress. The problem is that in order to use them, the PHP fcgi was called for each request. So, why would we have to call PHP every time that a file can be completely statically provided by the web server?

Read the rest of his version Installing WP Super Cache with lighttpd

function getIpBehindProxy

We were worried, about all the comments on kerala online, being marked as spam by the akismet plugin. When on detailed examination, we found that the basic problem was that wordpress was logging only the immediate downsteam ip as the remote address, well ours was a bit confusing setup, but to handle the traffic we needed it that way.

A search for wordpress behind reverse proxy, landed me to the wordpress support page. In fact the 5th entry on that page is done by Gopka, who is the lead on this project from Saturn.

We started to correct the remote address by overriding the global variable making slight changes to the wp-config, such that we will not accidentally overwrite the changes while upgrading wordpress. Well the code


if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        
$list explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
        
$_SERVER['REMOTE_ADDR'] = $list[0];
  }


when added to the wp-config, it started to log the first IP, and that would be mostly private IPs if the request was from organisations where internet was shared through proxies or using NAT. The case was same at our office, so we had to find the first public ip from the list of IPs and the code for function getIpBehindProxy was the out come.
Continue reading “function getIpBehindProxy”

WordPress object caching in file system

During the past couple of months, since we are maintaining a heavily loaded wordpress implementation, Kerala News Portal for Asianet, distributed across two servers, and having a daily visit of 50K, I was on the hunt for better caching and optimizing techniques. On the move, I happened to read the article by Jeff Starr, written some 15 months ago, and all the associated comments. It was sad to see that the file based cache was removed from wordpress, due to several reasons though.
After reading through this, I saw the official Function Reference for WP Cache, and the eAccelerator for WordPress by NeoSmart Technologies. Reading through the code written by Computer Guru of NeoSmart Technologies, tickled me and I just modified some parts, by pulling out the eaccelerator specific functions, and switching to a file system based store. I am not adding the code as pretty php code. Drop the file into wp-content, create a cache folder in wp-content and chmod folder to 755.
Download
Recently only I found that this has been outdated with new version of wordpress demanding more of the wrapper functions and capabilities. And this has been brought into the system. Functionally more or less the same, but will work on shared hosting for just object caching.
Download

JavaScript Aggregate; WordPress plugin

Collects all different linked javascripts and replaces with a combined single script, optionally compressed. Based on code originally written by David Holmes, Martin Kliehm, Gaetano Giunta. Uses the PHP adaptation of JSMin, published by Douglas Crockford as jsmin.c, also based on its Java translation by John Reilly.

After reading about Website Performance Tweaks, and a lot of other blogs and slides, I thought about how to cook up a javascript aggregate plugin for wordpress. The out come is wp-jsmin. Though this is in its infancy, it is being used in this blog, to combine all linked javascript to a single link, thereby reducing server requests. This code is still in the testing stage, and may break if the used scripts do not pass lint checks. I am planning to shift all the options to a options page in the wordpress admin page.

Those who are daring enough could download and try. Please put a comment here if you are using this on your wordpress. And for others who would like professional help, I would be most pleased to extend my services through RentACoder. Or for a whole dedicated wordpress team to design, build and maintain sites like Kerala News, Cirrus Travles or Rajeev Gandhi Center for Biotechnology, send an inquiry to Saturn.

Download

Distributed Media; a WordPress Challege

Though when the team at Saturn decided to build kerala online, on wordpress, they were quite confident, the complications started to get under their skins when the first wave hit the portal and at a point were the portal was being run from a single server and reached about 35K visits per day. The server was running on apache with about 2G Memory and hosted in Asianet the ISP division. There was times when the server was running at load averages above 60. All workarounds were getting futile, and there was certain times, like evening and early morning when the server hits the upper limit and ceases to respond. Continue reading “Distributed Media; a WordPress Challege”

Tunning (tuning) WordPress

Tweaking the wordpress 404 template such that error pages for images and other linked items do not go the full blown 404 error page.

Today on the server logs I found about 2900 404 errors triggered from a single IP, the logs are similar as


[IP REMOVED] keralaonline.com - [27/Apr/2009:11:38:34 +0530] "GET /wp-content/uploads/2009/04/photo993.jpg HTTP/1.0" 404 18013 "https://keralaonline.com/wp-content/uploads/2009/04/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
[IP REMOVED] keralaonline.com - [27/Apr/2009:11:38:38 +0530] "GET /wp-content/uploads/2009/04/photo997.jpg HTTP/1.0" 404 18013 "https://keralaonline.com/wp-content/uploads/2009/04/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
[IP REMOVED] keralaonline.com - [27/Apr/2009:11:38:39 +0530] "GET /wp-content/uploads/2009/04/photo999.jpg HTTP/1.0" 404 18013 "https://keralaonline.com/wp-content/uploads/2009/04/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"

one can see that the request is scripted and at a random interval, seems to be a script kiddie trying to leech images, but I got worried that even for this wordpress would go and output my pretty 404 page, which was as you could see is a whopping 17Kb, and takes about half a second to build. So just gave a twist and modified the top area of my 404 template Continue reading “Tunning (tuning) WordPress”